3,212 views

2 Answers

0 votes
0 votes

T(N)=T(N-1)+2N

       = T(N-2)+2N+2(N-1)

       = T(N-3)+2N+2(N-1)+2(N-2)

       = T(N-K) + 2N + 2(N-1)+2(N-2)+....+2(N-K+1)

       = T(N-K)+2{ N + (N-1) + (N-2) + .....+ (N-K+1) } ------> A

We know that T(1)=1 ===> N-K=1 ===> K=N-1, SUBSTITUTING THIS VALUE IN A

       = T(N-(N-1)) + 2 { N + (N-1) + (N-2) + .....+ (N-(N-1)+1) }

       = T(1)+2 { N + (N-1) + (N-2) + .....+ (2) }  ----> B , add +2 and -2 to B

       = T(1)+2 { N + (N-1) + (N-2) + .....+ (2) } +2-2

       = T(1)+2 { N + (N-1) + (N-2) + .....+ (2) +1 } -2 ---> Apply sum of first N natural numbers and T(1) = 1

       = 1 + 2{$\frac{N (N+1)}{2}$} - 2

       = N(N+1) -1

Related questions

0 votes
0 votes
1 answer
2
Shashank Kumar Mishr asked Mar 7, 2017
380 views
Find T.CT(n)=T(n-1)+1/n;t(n)=constant ifn<=2;
0 votes
0 votes
0 answers
3
akash.dinkar12 asked Jun 28, 2019
333 views
Show that in the recurrence$T(n)=\max_{0<q\leq n-1} (T(q)+T(n-q-1))+\Theta(n)$$T(n)=\Omega(n^2)$
0 votes
0 votes
1 answer
4
akash.dinkar12 asked Jun 27, 2019
298 views
Use the substitution method to prove that the recurrence $T(n)=T(n-1) + \Theta(n)$ has the solution $T(n) =\Theta(n^2)$.