Practice free →
HomeGATE CSEcomputerscienceAlgorithms › Iteratively unrolling T(n) = T(n/2) + c, the tot…

Iteratively unrolling T(n) = T(n/2) + c, the total work after reaching T(1) is

AT(1) + c·log₂ n, giving O(log n)
BT(1) + c·n, giving O(n)
CT(1) · 2^n, exponential growth
DT(1) · n^2, quadratic growth
Answer & Solution
Correct answer: A. T(1) + c·log₂ n, giving O(log n)
Each level halves n, contributing constant c work. To go from n down to 1, you need log₂ n halvings. Total: T(n) = T(1) + c · log₂ n = O(log n). This is binary search's running time, and it pops out cleanly from iteration without needing the master theorem.
Solve this in the app — GATE CSE practice & 24k+ MCQs →
Related questions