Skip to main content

GATE CSE 2025Algorithms › Growth of Functions & Complexity AnalysisVerified

GATE CSE 2025 PYQ: Consider the following recurrence relation: T ( n ) = 2 T ( n − 1 ) + n 2 n for n > 0 , T ( 0 ) = 1 T(n)=2…

Consider the following recurrence relation:
T(n)=2T(n−1)+n2n for n>0,T(0)=1 T(n)=2 T(n-1)+n 2^{n} \text { for } n>0, \quad T(0)=1

Which ONE of the following options is CORRECT?

  1. A
    T(n)=Θ(n22n)T(n)=\Theta\left(n^{2} 2^{n}\right)
    Correct answer
  2. B
    T(n)=Θ(n2n)T(n)=\Theta\left(n 2^{n}\right)
  3. C
    T(n)=Θ((log⁡n)22n)T(n)=\Theta\left((\log n)^{2} 2^{n}\right)
  4. D
    T(n)=Θ(4n)T(n)=\Theta\left(4^{n}\right)

Answer

(A) T ( n ) = Θ ( n 2 2 n ) T(n)=\Theta\left(n^{2} 2^{n}\right) T ( n ) = Θ ( n 2 2 n )

Approach

The recurrence is a decrease-by-one recurrence ($T(n)$ depends on $T(n-1)$), so the divide-and-conquer Master Theorem does not apply directly. The clean route is to scale out the exponential factor $2^n$: define $S(n)=T(n)/2^{n}$; the recurrence collapses to a trivial summation $S(n)=S(n-1)+n$, giving an exact closed form and hence the $\Theta$ class.

Dividing by $2^{n}$ linearizes the recurrence into $S(n)=S(n-1)+n$, giving the exact solution $T(n)=\frac{n^{2}+n+2}{2}\,2^{n}$. All three community answers converge on option A, and direct computation ($T(3)=56$, $T(4)=176$) is consistent with $\Theta(n^{2}2^{n})$.

Reviewed by GateIQ Editorial Team: IIT & IISc Alumni.