next up previous
Next: Up: Previous:

Example - Wrong Way

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

T(n) = $\Theta(n)$ + T(n/3)
=
$\Theta(n)$ + [ $\Theta(n/3)$ + T(n/32)]
=
$\Theta(n)$ + $\Theta(n)$ + T(n/32)
Terminates when
n/3i = 1, or i = log3 n.
=
\(\sum_{i=0}^{log_3 n-1} \Theta(n)\) + T(1)
=
\(\Theta(n log_3 n)\), not what we want!!!


next up previous
Next: Up: Previous: