private int GetReverseDPaths(SubArray A, SubArray B, int D, int k, int iDelta) { DiagonalVector V = m_vecReverse; int p = k + iDelta; int x; if ((k == -D) || (k != D && V[p + 1] <= V[p - 1])) { x = V[p + 1] - 1; } else { x = V[p - 1]; } int y = x - p; while (x > 0 && y > 0 && A[x] == B[y]) { x--; y--; } V[p] = x; return(x); }
private int GetForwardDPaths(SubArray A, SubArray B, int D, int k) { DiagonalVector V = m_vecForward; int x; if ((k == -D) || (k != D && V[k - 1] < V[k + 1])) { x = V[k + 1]; } else { x = V[k - 1] + 1; } int y = x - k; while (x < A.Length && y < B.Length && A[x + 1] == B[y + 1]) { x++; y++; } V[k] = x; return(x); }
public MyersDiff(int[] arA, int[] arB) { m_arA = arA; m_arB = arB; int N = arA.Length; int M = arB.Length; m_vecForward = new DiagonalVector(N, M); m_vecReverse = new DiagonalVector(N, M); }