What is the worst-case number of arithmetic operations performed by recursive binary search on a sorted array of size n?
Topic-wise GATE CS PYQs with verified steps
GATE CSE 2021 Set 2 · Q8
Time
Select one answerSingle correct
Solution
Official answer: B) (log2(n))
Searching, Sorting and HashingIn a recursive binary search on a sorted array of size , each recursive step performs a constant number of arithmetic operations (such as finding the midpoint and index increments/decrements).
The recurrence relation for the number of operations in the worst case is:
Applying the Master Theorem (or unrolling the recurrence):
Thus, the worst-case number of arithmetic operations is , which corresponds to option (B).
Try the question first, then check your work.
Examiner trap
Consider the recurrence relation for the number of steps when the search interval is halved at each recursive call.
This Searching, Sorting and Hashing previous year question is Q8 of the GATE CSE 2021 Set 2 paper. Find more GATE CSE PYQs on Searching, Sorting and Hashing in Algorithms, or browse all GATE CSE PYQs.
Free diagnostic
Take the 20-minute diagnostic: the 3 topics that cost you the most marks, and a rank range. Or sit 5 related Searching, Sorting and Hashing PYQs now with no account.
An official question by email at 7 AM IST, with a link to its verified solution. Unsubscribe in one click.
Searching, Sorting and Hashing has 27 GATE CSE PYQs across 20 papers from 2012 to 2026. 9 of them are 1-mark MCQs like this one, and it is the only one in GATE CSE 2021 Set 2.
How GATE tests Searching, Sorting and HashingIndependent practice explanation verified by the GateAI team. GATE is conducted by the IITs; question text follows the official paper.