Question: Algorithm should return edit distance between two input strings. s1 and s2. public int edit (String s1, String s2){ int len1 = s1.length; int len2

Algorithm should return edit distance between two input strings. s1 and s2.

public int edit (String s1, String s2){

int len1 = s1.length;

int len2 = s2.length

int m[][] = new int = [len1+1] [length2 +1];

//Hint for i = 1 to len1 m[i, 0] = i; for j = 1 to len2 m[0, j] = j; for i = 1 to len1 for j = 1 to len2 m[i, j] = min( m[i-1, j-1] + f(i,j), m[i-1, j] + 1, m[i, j-1] + 1 );

}

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!