binary search recurrence relation is (in the worst case)
T(n) = T(n/2) + O(1)
Using the Main Theorem

- n is the size of the problem.
- a is the number of subtasks in recursion.
- n / b is the size of each subtask. (It is assumed here that all subtasks are essentially the same size.)
- f (n) is the cost of the work performed outside of the recursive calls, which includes the cost of dividing the problem and the cost of merging the solutions with the subtasks.
Here a = 1, b = 2 and f (n) = O (1) [Constant]
f (n) = O (1) = O (n log b a)
= > T (n) = O (n log b a log 2 n)) = O (log 2 n)