next up previous
Next: Up: Previous:

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.\)


next up previous
Next: Up: Previous: