Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

In C++
image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts of Database Management

Authors: Philip J. Pratt, Mary Z. Last

8th edition

1285427106, 978-1285427102

More Books

Students also viewed these Databases questions

Question

Provide examples of Dimensional Tables.

Answered: 1 week ago