I am trying to solve the following Recurrence relation using substitution method and I am stuck almost half way. I know the answer is 2^n but I can't reach it.
At first, my question is:
Who decicdes the base cases? when do we take T(n)=1 for n=1
or T(n)=1 for n=0
?
The work I have done till now is as follows:
T(n) = T(n−1) + 2T(n−2)
T(n-1) = T(n-2) + 2T(n-3)
T(n-2) = T(n-3) + 2T(n-4)
Thus, using these, we can subsitute and we get
T(n) = T(n-2) + 2T(n-3) + 2T(n-2)
T(n) = 3T(n-2) + 2T(n-3)
(add and then substitue again)
T(n) = 5T(n-3) + + 6T(n-4)
Now assume we go till k
, but I am not able to generalize the usage of k
and find a correct assumption that will lead to a result of time complexity of Big O
of 2^n