TADM2E 8.1

From Algorithm Wiki
Revision as of 08:29, 11 January 2017 by Joky (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This is the regular editing dynamic programming, except that the diagonal as an extra possibility with cost = -1 when a swap is possible.

M[I, j] = M[I-1, j-1] if A[I] == B[j-1] and A[I-1] == B[j]