Question

Can anybody help me to Solve the following recurrence using iteration/expansion method?

1.T(n)= T(n-1)+ n,T(0)= 1

The solution should be like this way

T(k)=T(K-1)+K

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

......................
Was it helpful?

Solution

so given is:

1. T(n)= T(n-1) + n
2. T(0)= 1

so it gets like this:

T(0) = 1
T(1) = T(0) + 1 = 2
T(2) = T(1) + 2 = 4
T(3) = T(2) + 3 = 7
T(4) = T(3) + 4 = 11
T(5) = T(4) + 5 = 16

if you look closer it is:

T(k) = sum(k) +1    // sum(k)=1+2+3+4+5 ... + k-1+k

Take a look at Gauss The sum of all natural numbers, he told us, that sum(k)=(k^2+k)/2

so your solution should be:

T(k) = 1 + (k^2+k)/2
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top