The recurrence relation that arises in relation with the complexity of binary search is:
View worked solution
Answer: B
In Binary Search, we search for a target element in a sorted array of size as follows:
- Compare the target element with the middle element of the current search space. This step takes constant time, say (where is a constant).
- If the target is not found at the middle, we discard one half of the array and recursively search in the remaining half of size .
Since we only make one recursive call on a subproblem of half the size, the recurrence relation is:
where is a constant representing the time taken for the comparison and division steps.
Solving this recurrence using Master's Theorem or iterative substitution yields:
Thus, Option B is the correct recurrence relation.
Free practice · Your answers on this page are not saved.
