Question: In Java!!! Alignment 2 strings: insert gaps into both strings so that each character in one string is aligned with a gap, or the same

In Java!!!

Alignment 2 strings: insert gaps into both strings so that each character in one string is aligned with a gap, or the same character in the other string. Find the minimum cost.

Example, word1: kitchen word2: kitten

k i t - c h e n

k i t t - - e n

cost: 3

- - - - - - k i t c h e n

k i t t e n - - - - - - -

cost: 13

(a) Give a naive recursive way to solve this problem

(b) Use dynamic programming to solve this problem

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!