Which recurrence relation represents the time complexity of binary search?
Options
- A. T(N) = T(N - 1) + O(1)
- B. T(N) = 2T(N/2) + O(1)
- C. T(N) = T(N/2) + O(1)
- D. More than one of the above
- E. None of the above
Quiz Practice:
C. T(N) = T(N/2) + O(1)
Binary search examines one middle element and then continues with only half of the original search space. Therefore, its recurrence relation is T(N) = T(N/2) + O(1). Solving this recurrence gives O(log N) time complexity. In comparison, a recurrence such as T(N) = 2T(N/2) + O(1) represents an algorithm that recursively processes two halves, which is not how standard binary search operates.