Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started