next up previous
Next: Solution Techniques Up: CSE 2320: Algorithms and Previous: Example: Fibonacci

Solution Techniques



Guess: T(n) = O(2n), which means T(n) $\leq$ c2n




\begin{displaymath}T(n) \;\;=\;\; T(n-1) \;+\; T(n-2) \;+\; \Theta(1)\end{displaymath}


\begin{displaymath}<= \;\; c 2^{n-1} \;+\; c2^{n-2} \;+\; \Theta(1)\end{displaymath}


\begin{displaymath}=\;\; 1/2c2^n + 1/4c2^n + \Theta(1)\end{displaymath}


\begin{displaymath}=\;\; 3/4c2^n + \Theta(1)\end{displaymath}


\begin{displaymath}<=\;\; c2^n\end{displaymath}

If $1/4c2^n \geq \Theta(1)$ or $c \geq 4\Theta(1)/2^n$.
True for sufficiently large n.

Boundary: T(0) = 1 $\leq$ c20 = c, c$\geq$1

Actually, T(n) = \(\Theta((\frac{1+\sqrt{5}}{2})^n)\).



Copyright © 1998 The University of Texas at Arlington