Which of the following is correct recurrence relation for worst caset of binary search?
Show answerHide answer
Correct answer: (C) T(n) = T(n/2) + O(1), T(1) = T(0) = O(1)
Explanation
Each binary search step does a constant amount of work and continues in one half of the array, giving T(n) = T(n/2) + O(1), which solves to O(log n).