recategorized by
18,085 views
29 votes
29 votes

The recurrence relation that arises in relation with the complexity of binary search is:

  1. $T(n) = 2T\left(\frac{n}{2}\right)+k, \text{ k is a constant }$

  2. $T(n) = T\left(\frac{n}{2}\right)+k, \text{ k is a constant }$

  3. $T(n) = T\left(\frac{n}{2}\right)+\log n$

  4. $T(n) = T\left(\frac{n}{2}\right)+n$

recategorized by

7 Answers

0 votes
0 votes

Since, with every iteration of binary search, data set to be searched is divided into half of the original data set.Also,some constant time is lapsed during iteration during each iteration.So, recurrence relation for Binary search would be:

T(n)  =   T(n/2)   +   k,   where k is a constant.

–1 votes
–1 votes
They are asking about Binary search that is when array is already sorted with distinct element we can directly jump to middle and after comparing middle we can either go peft or go right we have to follow one path..

Ie T(n2) + k
Answer:

Related questions

35 votes
35 votes
6 answers
1
Kathleen asked Oct 4, 2014
13,940 views
Let $A$ and $B$ be any two arbitrary events, then, which one of the following is TRUE?$P (A \cap B) = P(A)P(B)$$P (A \cup B) = P(A)+P(B)$$P (A \mid B) = P(A \cap B)P(B)$$...
21 votes
21 votes
7 answers
2
Kathleen asked Oct 4, 2014
18,436 views
Algorithm design technique used in quicksort algorithm is?Dynamic programmingBacktrackingDivide and conquerGreedy method
15 votes
15 votes
7 answers
3
Kathleen asked Sep 18, 2014
11,796 views
The problem $\text{3-SAT}$ and $\text{2-SAT}$ are both in $\text{P}$both $\text{NP}$ complete$\text{NP}$-complete and in $\text{P}$ respectivelyundecidable and $\text{NP}...
33 votes
33 votes
4 answers
4
Kathleen asked Oct 5, 2014
8,944 views
An instance of a relational scheme $R(A, B, C)$ has distinct values for attribute $A$. Can you conclude that $A$ is a candidate key for $R?$