I just started learn how to do data structure and algorithm and i think this is like one of the hardest subject i picked up as compared to doing programming. I have such a hard time understanding hence i do need a little help.
For example, how does this happened?
T(n) = T(n-1) + $n^4$
T(n) = (T(n-2) + $n^4$) + $n^4$
T(n) = ((T(n-3) + $n^4$) + $n^4$) + $n^4$
...
T(n) = (T(1)) + (n+1)$n^4$
T(n) is in the order of θ(1) + $n^5$ + $n^4$
After the 3rd line of T(n), how did the T(n) after that formulate?
Hence, without understanding that i got problem trying to solve this Fibonacci recurrence relation of
T(n) = 2T(n-1) + 1
By solving this, i should be able to get the upper bound and lower bound complexity of the algorithm. Hence, I did it by expanding them like this
T(0) = 2 //base condition
T(1) = 2 //base condition
T(n) = 2T(n-1) + c
T(n) = 2T(n-2) + c + c
T(n) = 2T(n-3) + c + c + c
....
T(n) = 2T(n-k) + kc
Then i'm stuck at this. Any assistance on that ?