Start learning →

The recurrence T(n) = T(n/2) + O(1) for binary search solves to

AO(n) by unrolling
BO(log n) by halving log₂ n times
CO(n log n) by master theorem
DO(n²) by quadratic blowup
Answer & Solution
Correct answer: B. O(log n) by halving log₂ n times
Each step halves n, so after k steps the size is n/2^k. Reaching size 1 needs k = log₂ n steps, each doing constant work. Total: O(log n). Master theorem case 2 gives the same answer (a = 1, b = 2, d = 0; a = b^d so result is O(n^0 log n) = O(log n)).
Practise this question with Quill — GATE CSE →

Keep practising Algorithms

Browse all Algorithms questions for GATE CSE, or explore more Computer Science topics.

Start a Algorithms lesson →
Related questions