Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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.
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 0Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started