Difference between revisions of "TADM2E 8.1"

From Algorithm Wiki
Jump to: navigation, search
(Created page with "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...")
 
Line 1: Line 1:
 
This is the regular editing dynamic programming, except that the diagonal as an extra possibility with cost = -1 when a swap is possible.
 
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]
+
M[I, j] = M[I-1, j-1] - 1 ; if A[I] == B[j-1] and A[I-1] == B[j]

Revision as of 08:29, 11 January 2017

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] - 1 ; if A[I] == B[j-1] and A[I-1] == B[j]