Question: In C++ Write a program that takes in two strings via the command line and computes the edit distance between the two strings. The edit
Write a program that takes in two strings via the command line and computes the edit distance between the two strings. The edit distance between two strings is the number of edits needed to change one string into another. An edit can be either an insertion, substitution, or deletion. For example, the edit distance between "kitten" and "sitting" is 3: change the"k to "s";change the e" to "i": add a "g There is a well-known algorithm for computing the minimum edit distance between two strings, known as the Levenshtein distance. This algorithm requires the use of a 2-dimensional array, and is specified by the following formula: lev [i] [jmax (i, j), if min(i, )0 [j-1] 1, lev[i-1] 0j-1] + 0), rs are equal [j-1] 1, lev[i-1j-1 1), rs are different min(lev[i-1] j 1, lev[il if the two characte min(lev[i-1] j 1, lev[i] if the two characte This might seem like a complicated formula, but if you sketch it out as a 2-dimensional array, you will see that it really is not. The actual edit distance is the value in the bottom right corner of the 2d array Criteria Your program will be graded according to the syllabus criteria reflected in the attached rubric. You can expect a maximum string length of 25, and your program should run as follows: $g++ cs135prog. cpp $./a.out "bag" "hat
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
