// строим матрицу
for I := 0 to aCountLeft-1 do
begin
for J := 0 to aCountRight-1 do
begin
if aCompareFunc(I,J) then
PutAt(I,J, GetAt(I-1, J-1) + 1)
else
PutAt(I,J, Max(GetAt(I, J-1), GetAt(I-1, J)));
end;
end;
procedure DoDiff(aL, aR: Integer);
begin
if (aL >= 0) and (aR >= 0) and aCompareFunc(aL, aR) then
begin
DoDiff(aL-1, aR-1);
aReportProc(RR(l3diffSame, aL, aR));
end
else
if (aR >= 0) and ((aL < 0) or (GetAt(aL, aR-1) >= GetAt(aL-1, aR))) then
begin
DoDiff(aL, aR-1);
aReportProc(RR(l3diffAdded, aL, aR));
end
else
if (aL >= 0) and ((aR < 0) or (GetAt(aL, aR-1) < GetAt(aL-1, aR))) then
begin
DoDiff(aL-1, aR);
aReportProc(RR(l3diffDeleted, aL, aR));
end;
end;