Formal Definition

A sequence is a list tex2html_wrap_inline219 (e.g., tex2html_wrap_inline221 ).

A subsequence of X is an ordered sublist of X (e.g., tex2html_wrap_inline227 , but not tex2html_wrap_inline229 ).

A common subsequence of two sequences X and tex2html_wrap_inline233 is a subsequence of both of them.

The LCS, or longest common subsequence of X and Y is, well, their longest possible common subsequence. What is it?

We'll also use tex2html_wrap_inline239 to mean the i-element prefix of X. So tex2html_wrap_inline245 if X is length m.


next up previous
Next: Algorithmic Ideas Up: LONGEST COMMON SUBSEQUENCE Previous: Problem