Skip to main content

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…

What is the worst-case number of arithmetic operations performed by recursive binary search on a sorted array of size nn?

  1. A
    Θ(n)\Theta ( \sqrt{n})
  2. B
    Θ(log⁡2(n))\Theta (\log _2(n))
    Correct answer
  3. C
    Θ(n2)\Theta(n^2)
  4. D
    Θ(n)\Theta(n)

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.