Skip to content

GATE CS 2020 Q2 — Asymptotic Worst Case Time and Space Complexity

Explain with AI

For parameters aa and bb, both of which are ω(1)\omega(1), T(n)=T(n1/a)+1T(n) = T(n^{1/a})+1, and T(b)=1T(b)=1. Then T(n)T(n) is

Choose one option
View worked solution

Answer: A

To solve the given recurrence relation, we can use the substitution method.

The recurrence is given by:
T(n)=T(n1/a)+1T(n) = T(n^{1/a}) + 1 with the base case T(b)=1T(b) = 1.

Let us assume n=bakn = b^{a^k} for some integer k≥0k \ge 0. Taking the logarithm on both sides:

log⁡bn=ak\log_b n = a^k log⁡a(log⁡bn)=k\log_a (\log_b n) = k

Now, let S(k)=T(bak)S(k) = T(b^{a^k}). Substituting this into the recurrence relation:

S(k)=S(k−1)+1S(k) = S(k-1) + 1

The base case is when k=0k = 0:

S(0)=T(ba0)=T(b)=1S(0) = T(b^{a^0}) = T(b) = 1

Solving the linear recurrence S(k)=S(k−1)+1S(k) = S(k-1) + 1 with S(0)=1S(0) = 1 yields:

S(k)=k+1S(k) = k + 1

Substituting back k=log⁡a(log⁡bn)k = \log_a (\log_b n):

T(n)=log⁡a(log⁡bn)+1T(n) = \log_a (\log_b n) + 1

Therefore, the asymptotic complexity is:

T(n)=Θ(log⁡alog⁡bn)T(n) = \Theta(\log_a \log_b n)

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Asymptotic Worst Case Time and Space Complexity questions