I want to understand how to arrive at the complexity of the below recurrence relation.
T(n) = T(n-1) + T(n-2) + C
Given T(1) = C
and
The complexity is related to input-size, where each call produce a binary-tree of calls
Where T(n)
make 2
n
calls in total ..
T(n) = T(n-1) + T(n-2) + C
T(n) = O(2
n-1
) + O(2
n-2
) + O(1)
O(2
n
)
In the same fashion, you can generalize your recursive function, as a Fibonacci number
T(n) = F(n) + ( C * 2
n
)
Next you can use a direct formula instead of recursive way
Using a complex method known as Binet's Formula