I saw some textbook about the worst-case time complexity of Fibonacci Sequence. However, I have the following question:
The time complexity of Fibonacci Sequence
1
$\begingroup$
fibonacci-numbers
1 Answers
0
Alternatively, one may observe that, from $$ T(n)\le 2T(n-1)+c,\qquad n\ge 1, $$ by dividing by $2^n$ one deduces $$ \frac{T(n)}{2^n}\le \frac{T(n-1)}{2^{n-1}}+c\cdot\frac{1}{2^n},\qquad n\ge 1, $$$$ \frac{T(n)}{2^n}- \frac{T(n-1)}{2^{n-1}}\le c\cdot\frac{1}{2^n},\qquad n\ge 1, $$ then summing from $n=1$ to $n=N$ terms telescope on the left hand side giving $$ \frac{T(N)}{2^N}- \frac{T(0)}{2^{0}}\le c\cdot \sum_{n=1}^N\frac{1}{2^n}=c \cdot \left(1-\frac1{2^N}\right) $$ that is
$$ T(N)\le c \cdot \left(1-\frac1{2^N}\right)+T(0),\qquad N\ge 1. $$
