Skip to main content

GATE CSE 2021Algorithms › Recursion & Recurrence RelationsVerified

GATE CSE 2021 PYQ: For constants a ≥ 1 a \geq 1 a ≥ 1 and b > 1 b>1 b > 1 , consider the following recurrence defined on the…

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)?

  1. A
    If f(n)f(n) is nlog⁡2(n)n \log_2(n), then T(n)T(n) is Θ(nlog⁡2(n))\Theta(n \log_2(n))
  2. B
    If f(n)f(n) is nlog⁡2(n)\dfrac{n}{\log_2(n)}, then T(n)T(n) is Θ(log⁡2(n))\Theta(\log_2(n))
  3. C
    If f(n)f(n) is O(nlog⁡b(a)−ϵ)O(n^{\log_b(a)-\epsilon}) for some ϵ>0\epsilon >0, then T(n)T(n) is Θ(nlog⁡b(a))\Theta(n^{\log_b(a)})
    Correct answer
  4. D
    If f(n)f(n) is Θ(nlog⁡b(a))\Theta(n^{\log_b(a)}), then T(n)T(n) is Θ(nlog⁡b(a))\Theta(n^{\log_b(a)})

Answer

(C) If f ( n ) f(n) f ( n ) is O ( n log ⁡ b ( a ) − ϵ ) O(n^{\log_b(a)-\epsilon}) O ( n l o g b ​ ( a ) − ϵ ) for some ϵ > 0 \epsilon >0 ϵ > 0 , then T ( n ) T(n) T ( n ) is Θ ( n log ⁡ b ( a ) ) \Theta(n^{\log_b(a)}) Θ ( n l o g b ​ ( a ) )

Approach

Apply the Master Theorem to T(n)=aT(n/b)+f(n). Option C exactly matches case 1: when f(n) is polynomially smaller than $n^{\log_b a}, T(n)=\Theta(n^{\log_b a})$. Option D confuses case 1 with case 2, which has an extra $\log n$ factor. Options A and B propose bounds independent of a and b and are not universally true.

Option C correctly states Master Theorem case 1. Option D is the common case-2 error (missing log n factor); A and B are invalid because they assert bounds that ignore the constants a and b and are not universally true.

Reviewed by GateIQ Editorial Team: IIT & IISc Alumni.