next up previous
Next: Step 3: Bottom-Up Approach Up: CSE 2320: Algorithms and Previous: Duplicate Subproblems

Unique Subproblems

How many unique subproblems?



Assume that 1 $\leq$ i < j $\leq$ n or 1 $\leq$ i = j $\leq$ n.


\begin{displaymath}\left( \begin{array}{c} n \\ 2 \end{array} \right) + n\end{displaymath}

All ways of choosing i and j for problem m[i,j] when i < j +
All ways of choosing i and j for problem m[i,j] when i = j

\begin{displaymath}=\; \frac{n!}{2!(n-2)!} \;+\; n\end{displaymath}


\begin{displaymath}=\; \frac{n(n-1)}{2} \;+\; n\end{displaymath}


\begin{displaymath}=\; n^2/2 \;-\; n/2 \;+\; n\end{displaymath}


\begin{displaymath}=\; 1/2(n^2 \;+\; n)\end{displaymath}


\begin{displaymath}=\; \Theta(n^2).\end{displaymath}

Only polynomial number of unique subproblems.



Copyright © 1998 The University of Texas at Arlington