Complexity of the recursion: T(n) = T(n-1) + T(n-2) + C

前端 未结 5 1527
北恋
北恋 2021-01-12 11:12

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

5条回答
  •  醉梦人生
    2021-01-12 12:01

    Is "worse than exponential" accurate enough for your purposes? The special case C=0 defines http://en.wikipedia.org/wiki/Fibonacci_number, which you can see from the article is exponential. Assuming C is positive, your series will be growing faster than this. In fact, your series will lie between the Fibonacci series and a variant of the Fibonacci series in which the golden ratio is replaced by something very slightly larger.

提交回复
热议问题