next up previous
Next: Example - Right Way Up: CSE 2320: Algorithms and Previous: Note

Example: Factorial



Example - Wrong Way

T(n) = T(n-1) + $\Theta(1)$
=
$\Theta(1)$ + [$\Theta(1)$ + T(n-2)]
=
$\Theta(1)$ + T(n-2)
=
$\Theta(1)$ + [$\Theta(1)$ + T(n-3)]
=
$\Theta(1)$ + T(n-3)
=
$\Theta(1)$




Copyright © 1998 The University of Texas at Arlington