Longest common subsequence: Difference between revisions
m
Minor editorial improvements.
m (Replaced use of the word Sigma with the actual Greek Letter. Used bold font for emphasis.) |
m (Minor editorial improvements.) |
||
Line 8:
An ordered pair (i, j) will be called a match if x[i] == y[j], where 0 <= i < m and 0 <= j < n.
Define a strict Cartesian product-order (<) over these ordered pairs, such that (i1, j1) < (i2, j2) iff i1 < j1 and i2 < j2.
Given such a product-order
Finding
This set of matches can be represented as an m*n bit matrix, where each bit '''M[i, j]''' is True iff there is a match at the corresponding positions of strings x and y.
For example, the sequences "1234" and "1224533324" have an LCS of "1234":
|