Algorithm 1.
1: | n ← length(X) |
2: | m ← length(Y ) |
3: | diff ← n − m |
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 |