GateAI
Asymptotic Analysis

GATE CSE 2017 Set 2 · Q30

MCQ2 marksMedium

Time

Consider the recurrence function T(n)={2T(n)+1,n>22,0<n≤2T(n) = \begin{cases} 2T(\sqrt{n}) + 1, & n > 2 \\ 2, & 0 < n \le 2 \end{cases} Then T(n)T(n) in terms of Θ\Theta notation is

Select one answerSingle correct

Pick an option to check

Solution

Step-by-step verified solution

Official answer: B) (log n)

Asymptotic Analysis

We are given the recurrence relation:

T(n)=2T(n)+1for n>2T(n) = 2T(\sqrt{n}) + 1 \quad \text{for } n > 2

To solve this recurrence, change the variable: Let n=2m  ⟹  m=log⁡2nn = 2^m \implies m = \log_2 n.

Then n=n1/2=2m/2\sqrt{n} = n^{1/2} = 2^{m/2}.

Substituting this into the recurrence:

T(2m)=2T(2m/2)+1T(2^m) = 2T(2^{m/2}) + 1

Define a new function $S(m) = T(2^m)$:

S(m)=2S(m/2)+1S(m) = 2S(m/2) + 1

Now, applying the Master Theorem for S(m)=aS(m/b)+f(m)S(m) = a S(m/b) + f(m):

  • a=2a = 2

  • b=2b = 2

  • f(m)=1=Θ(m0)f(m) = 1 = \Theta(m^0)

  • Critical exponent: log⁡ba=log⁡22=1\log_b a = \log_2 2 = 1

Since f(m)=O(m1−ϵ)f(m) = O(m^{1 - \epsilon}) for ϵ=1\epsilon = 1, Case 1 of the Master Theorem applies:

S(m)=Θ(mlog⁡22)=Θ(m)S(m) = \Theta(m^{\log_2 2}) = \Theta(m)

Substitute back m=log⁡2nm = \log_2 n:

T(n)=S(m)=Θ(log⁡n)T(n) = S(m) = \Theta(\log n)

Therefore, the correct asymptotic bound is Θ(log⁡n)\Theta(\log n), which corresponds to Option (B).

Try the question first, then check your work.

Think the official key or this write-up is wrong?

Report error or challenge

Examiner trap

The misconception this question tests

This Asymptotic Analysis previous year question is Q30 of the GATE CSE 2017 Set 2 paper. Find more GATE CSE PYQs on Asymptotic Analysis in Algorithms, or browse all GATE CSE PYQs.

Free diagnostic

Where do you stand for GATE?

Take the 20-minute diagnostic: the 3 topics that cost you the most marks, and a rank range. Or sit 5 related Asymptotic Analysis PYQs now with no account.

One GATE CSE PYQ every morning

An official question by email at 7 AM IST, with a link to its verified solution. Unsubscribe in one click.

Asymptotic Analysis in GATE CSE

Asymptotic Analysis has 31 GATE CSE PYQs across 19 papers from 2011 to 2026. 12 of them are 2-mark MCQs like this one, and GATE CSE 2017 Set 2 has 3.

How GATE tests Asymptotic Analysis

More from GATE CSE 2017 Set 2

Share this solution

A plain-text card for WhatsApp or Telegram study groups.

GateAI solution cardGATE CSE 2017 Set 2 · Q30 · MCQ

Consider the recurrence function T(n) = 2T(√(n)) + 1, & n > 2 2, & 0 < n ≤ 2 Then T(n) in terms of notation is

Topic-wise GATE CS PYQs with verified steps

Independent practice explanation verified by the GateAI team. GATE is conducted by the IITs; question text follows the official paper.