Can anyone help me finding the time complexity of
T(n)=1 if n<=0 T(n)=T(n-1)+T(n-2)+n
Can anyone help me finding the time complexity of
T(n)=1 if n<=0 T(n)=T(n-1)+T(n-2)+n
Consider
F(n) = T(n) + n + 3.
This gives us
F(n) - (n+3) = F(n-1) - (n-1+3) + F(n-2) - (n-2+3) + n
i.e
F(n) - 3 = F(n-1) - 2 + F(n-2) - 1
i.e
F(n) = F(n-1) + F(n-2)
which is a Fibonacci like sequence!
It is well known that for fibonacci like sequences, F(n) = Theta(phi^n)
where phi is the golden ratio.