Question: need the answer 5. (20 points) Let A = ai . . . am and B = b| . . . bn be two strings

need the answer 5. (20 points) Let A = ai . .need the answer

5. (20 points) Let A = ai . . . am and B = b| . . . bn be two strings with length m and n respectively. Design a dynamic programming based algorithm to convert A into B with minimum cost using the following rules. For a cost of 3, one can delete any letter from a string. For a cost of 5, one can insert a letter in any position. For a cost of 7, one can replace any letter by any other letter. For example, you can convert A - abcabc to B abacab via the following sequence of operations: abcabc with a cost of 7 can be converted to abaabc, which with a cost of 3 can be converted to ababc, which with a cost of 3 can be converted to abac, which with a cost of 5 can be converted to abacb, which with a cost of 5 can be converted to abacab. Thus the total cost for this conversion is 23 (may not be the cheapest one)

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!