Question: Compute the edit distance between paris and alice. Write down the 5 X 5 array of distance between all prefixes as computed by the Dynamic

Compute the edit distance between paris and alice. Write down the 5 X 5 array of distance between all prefixes as computed by the Dynamic Progamming algorithm below.

EDITDISTANCE(s1, s2)

int m[i,j] = 0

for i <-- 1to |s1|

do m[i,0] = i

for j <-- 1 to |s2|

do m[0,j] = j

for i <-- 1 to |s1|

do for j <-- 1 to |s2|

do m[i,j] = min{m[i-1, j-1] + if(s1[i] = s2[j]) then 0 else 1 fi,

m[i-1, j] +1,

m[i,j -1] +1}

return m[|s1|, |s2|]

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 Databases Questions!