GATE 2017 CS (CS2) – Question 40
$T(n)=2T(\sqrt n)+1$ for n>2, and T(n)=2 for 0<n≤2. Find its asymptotic order.
Practise this question in The GATE Grind →
Show answer and explanation
Correct answer: (B) $\Theta(\log n)$
Explanation
Set m=log₂n and S(m)=T(2ᵐ). Then S(m)=2S(m/2)+1 with constant-size base case, so S(m)=Θ(m) by the master theorem. Substitution back gives T(n)=Θ(log n), B. Equivalently the recursion tree has Θ(log n) leaves.
More Asymptotic Analysis and Time/Space Complexity questions
- GATE 2017 CS (CS2) Q48
- GATE 2012 CS (CS1) Q15
- GATE 2012 CS (CS1) Q28
- GATE 2013 CS (CS1) Q40
- GATE 2013 CS (CS1) Q41
- GATE 2011 CS (CS1) Q47
All Asymptotic Analysis and Time/Space Complexity questions →