GATE / CS ARCHIVE

GATE CSE 2017 SET 2 / QUESTION 30

GATE CSE 2017 Set 2 Q30

Algorithms · Asymptotic Analysis & Recurrences · Full GATE CSE 2017 Set 2 paper

GATE 2017 Set 2, Q30 2 marks · MCQ
Report issue

Asymptotic Analysis & Recurrences

Question 30, GATE 2017: T(n)=2T(√n)+1 for n>2, and T(n)=2 for 0<n≤2. What is its asymptotic order? A:Θ(log log n). B:Θ(log n). C:Θ(√n). D:Θ(n).
Tap to enlarge
Your answer
Answer & solution

Official answer: B

1. The argument shrinks by square root, so transform to its logarithm. Put m=log₂n and S(m)=T(2m). Since √(2m)=2m/2, the recurrence becomes S(m)=2S(m/2)+1 with a constant base for m≤1.

2. This is a binary recursion tree with Θ(m) leaves and Θ(m) total nodes. Equivalently, the Master theorem has a=2,b=2 and f(m)=1, giving S(m)=Θ(m).

3. Substituting back gives T(n)=Θ(log n), option B. The recursion depth is only Θ(log log n), but each level branches into twice as many subproblems. Counting depth alone misses the total work.

Original paper, page 11 · Answer key