Longest common subsequence: Difference between revisions

m
Corrected definition of the strict Cartesian product-order.
m (→‎{{header|Phix}}: added syntax colouring, marked p2js compatible)
m (Corrected definition of the strict Cartesian product-order.)
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.
 
Define the strict Cartesian product-order (<) over matches, such that (i1, j1) < (i2, j2) iff i1 < j1i2 and i2j1 < j2. Defining (>) similarly, we can write m2 < m1 as m1 > m2.
 
If i1 <= j1i2 and i2j2 ><= j2j1 (or i1i2 ><= i2i1 and i2j1 <= j2) then ''neither'' m1 < m2 ''nor'' m1 > m2 are possible; and m1, m2 are ''incomparable''.
 
Defining (#) to denote this case, we write m1 # m2. Because the underlying product order is strict, m1 == m2 (''i.e.'', i1 == i2 and j1 == j2) implies m1 # m2.
159

edits