Computational complexity of Fibonacci Sequence

后端 未结 11 1450
慢半拍i
慢半拍i 2020-11-21 10:27

I understand Big-O notation, but I don\'t know how to calculate it for many functions. In particular, I\'ve been trying to figure out the computational complexity of the nai

11条回答
  •  广开言路
    2020-11-21 10:31

    It is bounded on the lower end by 2^(n/2) and on the upper end by 2^n (as noted in other comments). And an interesting fact of that recursive implementation is that it has a tight asymptotic bound of Fib(n) itself. These facts can be summarized:

    T(n) = Ω(2^(n/2))  (lower bound)
    T(n) = O(2^n)   (upper bound)
    T(n) = Θ(Fib(n)) (tight bound)
    

    The tight bound can be reduced further using its closed form if you like.

提交回复
热议问题