The problem can be evaluated systematically using a tabular computation. In this approach, we compute V(i,j) for the all possible values for i and j starting from smaller such values and increasing them in a row-wise manner.
We use a table of size in which we store the values of V(i,j) for all choices of i and j. Finally V(n, m) is the required alignment score.
The following pseudo code describes the algorithm:
for i=1 to n do begin for j=1 to m do begin Calculate V(i,j) using V(i-1,j-1), V(i,j-1), V(i-1,j) end end