Question: Compute the edit distance between Cats and Fast. 1 . Write down the 5 x 5 array of distances between all prefixes as computed by

Compute the edit distance between Cats and Fast.
1. Write down the 5 x 5 array of distances between all prefixes as computed by the following algorithm.
int EditDistance(char s[1.m], char t[1..n))
"harades of hole ll afad the ecit distante belleen the first i characters of s and the fist) declare int d[O..m, O.n] for i from 0 to m
d[i,0]:= i// the distance of any first string to an empty second string
for j from 0 to n
diO, jl := j/ the distance of any second string to an empty first string
for j from 1 to n for i from 1 to m
if s[i]= t[i] then
dfi, jl := dfi-1, j-1]// no operation required else
dfi, j] := minimum
(di-1, j]+1,// a deletion dii, j-1]+1,// an insertion d[i-1, j-1]+1// a substitution)
NES
return dim.n

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!