What is the worst-case number of arithmetic operations performed by recursive binary search on a sorted array of size ?
GATE CSE 2021Algorithms › Growth of Functions & Complexity AnalysisVerified
GATE CSE 2021 PYQ: What is the worst-case number of arithmetic operations performed by recursive binary search on a sorted…
- A
- BCorrect answer
- C
- D
Answer
(B) Θ ( log 2 ( n ) ) \Theta (\log _2(n)) Θ ( lo g 2 ( n ))
Approach
Model the recursive binary search as a recurrence: each call performs a constant number of arithmetic/comparison operations and then recurses on only one half of the current search range. Solving that recurrence gives the worst-case count.
The recurrence T(n)=T(n/2)+Θ(1) is the standard model for recursive binary search. It solves to $Θ(log_2 n)$, matching option B.
Reviewed by GateIQ Editorial Team: IIT & IISc Alumni.