Open In App

ISRO | ISRO CS 2017 – May | Question 14

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

(A)



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

(B)



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

(C)

T(n) = T(n / 2) + log n

(D)

T(n) = T(n / 2) + n


Answer: (B)
Explanation:

Binary Search is a linear searching algorithm and takes O(log n) when array is sorted. Refer: Binary Search T(n) = T(n / 2) + k , where k is constant produces a complexity of O(log n)

Hence Option(B) is the correct answer.

Quiz of this Question
Please comment below if you find anything wrong in the above post

Article Tags :