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

Solution Techniques

\(T(n) = \left\{ \begin{array}{ll}
\Theta(1) & {\rm if} \; n = 0 \\
T(n-1) + \Theta(1) & {\rm if} \; n > 0
\end{array} \right. \)



Guess:



Show:



Assume:



T(n) $\leq$ c(n-1) + $\Theta(1)$
= cn - c + $\Theta(1)$
$\leq$ cn
If c $\geq \Theta(1)$. True for large enough c.



Initial Conditions: T(1) = $\Theta(1)$$\leq$ cn



Copyright © 1998 The University of Texas at Arlington