Dynamic Programming for Approximate String Matching
Assume S has length m and T has length n.
For all i and j, 0 < i < m and 0 < j < n, we find the maximum score for the sequences S[1..i] and T[1..j].
The “dynamic program” fills in a (m+1)x(n+1) matrix M in increasing order of i and j with these maximum values.
Once the dynamic program has completed we can recover the optimal string S’ and T’ from the matrix M.