Consider the recurrence Tn 10 if n 0 2T n 1 3n 1 if n
Consider the recurrence T(n) = 10 if n = 0 = 2T (n - 1) + 3n + 1 if n greaterthanorequalto 1 Solve the recurrence to find a closed form for T(n). You do not have to eliminate summations in your closed form. If you typeset your entire written assignment (including all formulas and diagrams, if applicable), you will receive 1 bonus mark. The basics of the typesetting system will be covered in the labs, but all typed assignments (regardless of which program was used) are eligible for the bonus.
Solution
T(n) = 10 for n=0
T(n) = 2T(n-1) + 3n +1
T(n-1) = 2T(n-2) + 3(n-1) +1
T(n-2) = 2T(n-3) + 3(n-2) +1
.
.
.
.
T(n) = 23T(n-3) + 3{20n+21(n-1)+22(n-2)} + (1+21+22)
So in general,
T(n) = 2nT(0) + (1+21+22+...+2n-1) + 3{20n+21(n-1)+22(n-2)+...+2n-1(1)}
So let T(n) = 10*2n + 2n - 1 + 3S
Where S = 20n+21(n-1)+22(n-2)+...+2n-1(1)
2S = 21n+ 22(n-1)+ .......+2n-1(2)+2n
by substract
S = n + 21 + 22 + 23 +...+2n-1 + 2n
. S = n + 2(2n-1)
So T(n) = 10*2n + 2n - 1 +3(n+2(2n-1))
T(n) = 11*2n - 1 + 3n + 6*2n - 6
T(n) = 17*2n + 3n - 7
