I am not asking for a solution for my homework , i made a solution for this equation and just wanna know whether it is true
T(n) = 2 * T(n-2) - 15
T(1) = T(2) = 40
SOLUTION
Level 1
T(n) = 2 ( T(n-4) -15 ) -15
Level 2
= 2 ( 2 ( T(n-6) -15 ) -15 ) -15
Level 3
= 2 ( 2 ( 2 ( T(n-8) -15 ) -15 ) -15 ) -15
From these substitutions i concluded that
T(n) = 2^i [ T(n -2(i+1) ] - (2^(i+1) -1 ) * 15
So the solution i reached was
T(n) = 25 * 2^[ (n-1)/2 ] -15
AND I USED T(1) = 40
BUT the book i am reading : ” Algorithms analysis : an active learning approach ” used T(2) = 40 and reached another solution
IS MY SOLUTION TRUE TOO ?
Note I am using the direct substitution here not any other method like Master or substitution method
Thanks
When deriving formulae, one good way of checking is to substitute and check it with a known case.
In this case, substituting 1 results in
T(1) = 25*2^((1-1)/2) - 15 = 10, butT(1)should be 40.Additionally, in the derivation, the level 1 derivation should be
2( 2T(n-4) - 15) - 15instead of2( T(n-4) - 15) - 15.