Skip to content
Related Articles

Related Articles

Save Article
Improve Article
Save Article
Like Article

GATE | GATE-CS-2006 | Question 51

  • Last Updated : 28 Jun, 2021

Consider the following recurrence:

gate_2006_51

Attention reader! Don’t stop learning now.  Practice GATE exam well before the actual exam with the subject-wise and overall quizzes available in GATE Test Series Course.

Learn all GATE CS concepts with Free Live Classes on our youtube channel.

Which one of the following is true?



(A) T(n) =

\theta

(loglogn)
(B) T(n) =

\theta

(logn)
(C) T(n) =

\theta

(sqrt(n))
(D) T(n) =

\theta



(n)
(A) A
(B) B
(C) C
(D) D


Answer: (B)

Explanation:  

Background Required – Recurrence Solving using Substitution Method.

Answer – B
Unrolling the recursion,

T(n)  =  2T(n^(1/2)) + 1
=  2^2T(n^(1/4)) + 2
= 2^3T(n^(1/8)) + 3
.
.    k  steps
.
=  2^kT(n^(1/2k)) + k              …………. (1)

Using the Base case,

n^(1/2k) = 2
Taking log on both sides
log2n = 2k
k = log2log2n

From (1),

T(n) =  log2n  +  log2log2n
= Theta(log2n)

Here log2n : log(base 2) n

Related :
http://geeksquiz.com/algorithms-analysis-of-algorithms-question-17-2/

 

This solution is contributed by Pranjul Ahuja .

 

 

Quiz of this Question

My Personal Notes arrow_drop_up
Recommended Articles
Page :