(1)T(n)=T(n-1)+n/2; T(1)=1
(2)T(n)=8T(n-1)-15T(n-2); T(1)=1,T(2)=4
這是數學問題吧?
(1)T(n)=T(n-1)+n/2 = T(n-2) + (n-1)/2 + n/2 = ...... = T(n - (n-1)) + 2/2 + ... (n-1)/2 + n/2 = (n+2)(n-1)/4 +1;
( 2) T(n) - 3T(n-1) = 5(T(n-1) - 3T(n-2)) , 令S(n)= T(n+1) - 3T(n) ,n>=1;
有S(n) = 5S(n-1),S(1) = 4-3*1=1;
∴ S(n) = 5^(n-1);
∴T(n+1) - 3T(n) = 5^(n-1);即T(n+1) = 3T(n) + 5^(n-1) = 3(3T(n-1) + 5^(n-2))+5^(n-1) =... = 3^n * T(1) + 5^n(1-(3/5)^n)/2
∴ T(n) = 3^(n-1) + 5^(n-1)/2 (1- (3/5)^(n-1)),n>= 1;