Skip to content
Official PYQ · 1996

GATE CS 1996 Q2.12 — Asymptotic Worst Case Time and Space Complexity

Explain with AI

The recurrence relation

  • T(1)=2T(1) = 2
  • T(n)=3T(n4)+nT(n) = 3T (\frac{n}{4}) +n

has the solution T(n)T(n) equal to

Choose one option
View worked solution

Answer: A

We can solve the recurrence relation T(n)=3T(n4)+nT(n) = 3T\left(\frac{n}{4}\right) + n using the Master Theorem for divide-and-conquer recurrences of the form T(n)=aT(nb)+f(n)T(n) = aT\left(\frac{n}{b}\right) + f(n):

  • Here, a=3a = 3, b=4b = 4, and f(n)=n=Θ(n1)f(n) = n = \Theta(n^1).
  • We compare f(n)f(n) with nlog⁡ba=nlog⁡43n^{\log_b a} = n^{\log_4 3}.

Since log⁡43≈0.792<1\log_4 3 \approx 0.792 < 1, we have f(n)=Ω(nlog⁡43+ϵ)f(n) = \Omega\left(n^{\log_4 3 + \epsilon}\right) for ϵ≈0.2\epsilon \approx 0.2. This corresponds to Case 3 of the Master Theorem.

To confirm, we check the regularity condition: af(nb)≤cf(n)a f\left(\frac{n}{b}\right) \le c f(n) for some constant c<1c < 1.
3(n4)=34n≤cnfor c=34<13 \left(\frac{n}{4}\right) = \frac{3}{4}n \le c n \quad \text{for } c = \frac{3}{4} < 1

Since the regularity condition holds, the solution is T(n)=Θ(f(n))=Θ(n)T(n) = \Theta(f(n)) = \Theta(n), which implies T(n)=O(n)T(n) = O(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