Open In App
Related Articles

GATE | GATE CS 2020 | Question 12

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Report issue
Report
For parameters a and b, both of which are ω(1), T(n)=T(n1/a)+1, and T(b)=1. Then T(n) is (A) Θ(logalogbn) (B) Θ(logabn) (C) Θ(logblogan) (D) Θ(log2log2n)

Answer: (A)

Explanation: Given,
T(n) = T(n1/a)+1, 
T(b) = 1 
Now, using iterative method,
= T(n) 
= [T(n1/a2)+1] + 1
= [T(n1/a3)+1] + 2
= [T(n1/a4)+1] + 3
.
.
.
= [T(n1/ak)+1] + (k-1)
= T(n1/ak) + k 
Let,
→ n1/ak = b
→ log(n1/ak) = log(b)
→ ak = log(n) / log (b) = logb(n)
→ k = logalogb(n)
Therefore,
= T(n1/ak) + k
= T(b) + logalogb(n)
= 1 + logalogb(n)
= Θ(logalogb(n)) 
Option (A) is correct.

Quiz of this Question

Last Updated : 26 May, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads