GATE / CS ARCHIVE

GATE CSE 2004 / QUESTION 84

Solve a linear nonhomogeneous recurrence

Algorithms · Asymptotic Analysis & Recurrences · Full GATE CSE 2004 paper

GATE 2004, Q84 2 marks · MCQ
Report issue

Asymptotic Analysis & Recurrences

Question 84, GATE 2004: Solve T(1)=1 and T(n)=2T(n−1)+n for n≥2. The sign is plus in the rendered sources, despite faulty text extraction.
Options:
(A) 2^(n+1)−n−2
(B) 2^n−n
(C) 2^(n+1)−2n−2
(D) 2^n+n
Tap to enlarge
Your answer
Answer & solution

Answer: A (no official key was published)

1. The rendered recurrence is T(1)=1 and T(n)=2T(n−1)+n. A particular solution is −n−2, so T(n)=C·2n−n−2.

2. Using T(1)=1 gives 2C−3=1 and C=2. Therefore T(n)=2n+1−n−2, A.

3. Direct substitution gives 2[2n−(n−1)−2]+n=2n+1−n−2.

4. Teaching check: An alternative transformation is U(n)=T(n)+n+2. Then U(n)=2U(n−1), U(1)=4, so U(n)=2n+1. Subtract n+2 to recover T(n); this directly verifies the affine particular solution.

Original paper, page 12