next up previous
Next: Distinct Subproblems Up: CSE 2320: Algorithms and Previous: Dynamic Programming

Dynamic Programming

2. Overlapping Subproblems.



\psfig{figure=figures/f7-3.ps,width=3.5in,height=2in}

Define: c[i,j] = length of LCS for Xi and Yj.

c[i,j] = \(\left\{ \begin{array}{ll}
0 & {\rm if} \;i=0 \; {\rm or} \; j = 0 \\
c[i-1,...
...i-1,j]) & {\rm if} \;i,j > 0 \; {\rm and} \; x_i \neq y_j
\end{array} \right.\)



Copyright © 1998 The University of Texas at Arlington