Longest common subsequence: Difference between revisions
Content added Content deleted
m (Improved discussion of M interpreted as an m*n boolean matrix. Simplified O(n) terms.) |
m (Revised interpretation of M as a relation.) |
||
Line 10: | Line 10: | ||
An ordered pair (i, j) will be called a match if ''A''[i] == ''B''[j], where 0 ≤ i < m and 0 ≤ j < n. |
An ordered pair (i, j) will be called a match if ''A''[i] == ''B''[j], where 0 ≤ i < m and 0 ≤ j < n. |
||
Define the strict Cartesian [https://en.wikipedia.org/wiki/Product_order product-order] (<) over matches, such that (i1, j1) < (i2, j2) & |
Define the strict Cartesian [https://en.wikipedia.org/wiki/Product_order product-order] (<) over matches, such that (i1, j1) < (i2, j2) ⇔ i1 < i2 and j1 < j2. Defining (>) similarly, we can write m2 < m1 as m1 > m2. |
||
We write m1 <> m2 to mean that either m1 < m2 or m1 > m2 holds, ''i.e.'', that m1, m2 are ''comparable''. |
We write m1 <> m2 to mean that either m1 < m2 or m1 > m2 holds, ''i.e.'', that m1, m2 are ''comparable''. |
||
Line 22: | Line 22: | ||
Finding an LCS can then be restated as the problem of finding a chain of maximum cardinality p over the set of matches '''M'''. |
Finding an LCS can then be restated as the problem of finding a chain of maximum cardinality p over the set of matches '''M'''. |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
'''Background''' |
'''Background''' |