The Gateway to Computer Science Excellence
0 votes
137 views
what is the recurrence relation for binary search and linear search?

please explain how to derive them.
in Algorithms by Loyal (8.2k points) | 137 views
0
$T(n)=T(\frac{n}{2})+1$ for binary search

$T(n)=T(n-1) +1$ for linear search.

1 Answer

+2 votes
Best answer

For binary search: 

For Linear Search:

by (453 points)
selected by
Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,650 questions
56,192 answers
193,988 comments
94,863 users