Skip to content
Official PYQ · 2021

GATE CS 2021 Set 2 Q39 — Asymptotic Worst Case Time and Space Complexity

Explain with AI

For constants a≥1a \geq 1 and b>1b>1, consider the following recurrence defined on the non-negative integers:

T(n)=a⋅T(nb)+f(n)T(n) = a \cdot T \left(\dfrac{n}{b} \right) + f(n) Which one of the following options is correct about the recurrence T(n)T(n)?

Choose one option
View worked solution

Answer: C

The given recurrence relation is:

T(n)=a⋅T(nb)+f(n)T(n) = a \cdot T\left(\frac{n}{b}\right) + f(n)

where a≥1a \geq 1 and b>1b > 1. This is the standard form analyzed by the Master Theorem. Let us evaluate each option based on the cases of the Master Theorem:

1. Analysis of Option C (Correct)

According to Case 1 of the Master Theorem:

If f(n)=O(nlog⁡b(a)−ϵ)f(n) = O(n^{\log_b(a) - \epsilon}) for some constant ϵ>0\epsilon > 0, then the work done at the leaves dominates the recurrence. Thus, the time complexity is:

T(n)=Θ(nlog⁡b(a))T(n) = \Theta(n^{\log_b(a)})

This matches Option C exactly.

2. Analysis of Other Options

  • Option A: If f(n)=nlog⁡2(n)f(n) = n \log_2(n), the complexity T(n)T(n) depends on the relationship between f(n)f(n) and nlog⁡b(a)n^{\log_b(a)}. For example, if a=4a = 4 and b=2b = 2, then nlog⁡b(a)=n2n^{\log_b(a)} = n^2. Since f(n)=O(n2−ϵ)f(n) = O(n^{2-\epsilon}), Case 1 applies and T(n)=Θ(n2)T(n) = \Theta(n^2), not Θ(nlog⁡2(n))\Theta(n \log_2(n)). Thus, Option A is incorrect in general.
  • Option B: Since T(n)=aT(n/b)+f(n)T(n) = a T(n/b) + f(n) and a≥1a \geq 1, the overall complexity T(n)T(n) must be at least Ω(f(n))\Omega(f(n)). If f(n)=nlog⁡2(n)f(n) = \frac{n}{\log_2(n)}, then T(n)T(n) cannot be Θ(log⁡2(n))\Theta(\log_2(n)) because nlog⁡2(n)\frac{n}{\log_2(n)} grows strictly faster than log⁡2(n)\log_2(n). Thus, Option B is incorrect.
  • Option D: According to Case 2 of the Master Theorem, if f(n)=Θ(nlog⁡b(a))f(n) = \Theta(n^{\log_b(a)}), then the work is evenly distributed across all levels of the recursion tree. The complexity is:
  • T(n)=Θ(nlog⁡b(a)log⁡n)T(n) = \Theta(n^{\log_b(a)} \log n)

    Therefore, Option D is incorrect.

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

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