next up previous
Next: Up: Previous:

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)$



next up previous
Next: Up: Previous: