**1.** **Optimal Substructure.**

**Define:** Given X =
,
the ith prefix of X, i = 0, .., m, is
.
*X*_{0} is empty.

**Theorem 16.1**

Let X = and Y = be sequences, and Z = be any LCS of X and Y.

- 1.
- If
*x*_{m}=*y*_{n}, then*z*_{k}=*x*_{m}=*y*_{n}and*Z*_{k-1}is an LCS of*X*_{m-1}and*Y*_{n-1}.

- 2.
- If
,
then
implies that Z is an LCS
of
*X*_{m-1}and Y.

- 3.
- If
,
then
implies that Z is an LCS
of X and
*Y*_{n-1}.

Thus the LCS problem has optimal substructure.