Which of the following statements is correct about the divide and conquer approach of binary
Which of the following statements is correct about the divide and conquer approach of binary
search technique?
Show answerHide answer
Correct answer: (B) The worst-case time complexity of binary search is O(log n).
Explanation
Each step compares with the middle element and discards half the array, so T(n) = T(n/2) + O(1), giving O(log n) in the worst case. The best case is O(1) and the average case is O(log n), and the recurrence has T(n/2) once, not twice.