next up previous
Next: Note Up: l2 Previous: Solution Techniques

Solution Techniques



Example:

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



T(n) = n + 2T(n/2)
     = n + 2[n/2 + 2T(n/4)]
     = n + n + 4T(n/4)
     = n + n + 4[n/4 + 2T(n/8)]
     = n + n + n + 8T(n/8)
     = n + n + n + 8[n/8 + 2T(n/16)]
     = n + n + n + n + 16T(n/16)


next up previous
Next: Note Up: l2 Previous: Solution Techniques