next up previous
Next: Example - Right Way Up: l2 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)$



next up previous
Next: Example - Right Way Up: l2 Previous: Note