Question: Please edit this editDist method to add another type of edit, which is to transpose(swap) two items that are next to each other in the

Please edit this editDist method to add another type of edit, which is to transpose(swap) two items that are next to each other in the original sequence. The transposition has a cost of 1, instead of using a deletion followed by an insertion, which has cost of 2.

Please edit this editDist method to add another type of edit, which

static int editDist(String strl , String str2, int m ,int n) if(m== 0) return n; if(n-0) return m; if (str1.charAt(m-1)str2.charAt(n-1)) return editDist(str1, str2, m-1, n-1); str2, m, n-1), Insert editDist(str1, str2, m-1, n), // Remove editDist(strl, str2, m-1, n-1) // Replace return 1 min C editDist(strl, s 0

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!