next up previous
Next: Up: Previous:

Brute Force Solution: Try all possible parenthesizations

How many? P(n)



\(A_1 A_2 ... A_k \mid A_{k+1} ... A_{n-1} A_n\)
P(k)*P(n-k), k = 1 to (n-1)

\begin{displaymath}P(n) = \left\{ \begin{array}{ll}
1 & n=1 \\
\sum_{k=1}^{n-1} P(k) P(n-k) & n>1
\end{array} \right.\end{displaymath}



See Cormen et al., Problem 13-4 for solving this recurrence.
P(n) = \(\frac{1}{n} \left( \begin{array}{c} 2n-2 \\ n-1 \end{array} \right)\)
= \(\Omega(\frac{4^{n-1}}{(n-1)^\frac{3}{2}})\), which is exponential in n.


next up previous
Next: Up: Previous: