Skip to main content
. Author manuscript; available in PMC: 2013 Mar 1.
Published in final edited form as: Interact Comput. 2012 Mar 1;24(2):55–68. doi: 10.1016/j.intcom.2012.01.003

Algorithm 1.

M&M Matching v.2

1: n ← length(X)
2: m ← length(Y )
3: diff ← nm
4: c ← array[diff+1][m]
5: for j := 0 to m −1 do
6: for i := 0 to diff do
7:   cost ← d(xj+i, yj)
8:   if j > 0 then
9:    cost ← cost + c[i][j − 1]
10:   end if
11:   if i > 0 then
12:    c[i][j] ← min(cost, c[i − 1][j])
13:   else
14:    c[i][j] ← cost
15:   end if
16: end for
17: end for