Question: == == = static int distanceA (String first, String second, int starti, int leni, int start2, int len2) { if (len1 0) {return len2; }

== == = static int distanceA (String first, String second, int starti, int leni, int start2, int len2) { if (len1 0) {return len2; } else if (len2 0) { return len1; } int change distanceA (first, second, starti + 1, len1 1, start2 + 1, len2 1); if (first.charAt (starti) != second.charAt (start2)) { change++; } int deletion distanceA (first, second, starti + 1, len1 1, start2, len2) + 1; int insertion distanceA (first, second, starti, leni, start2 + 1, len2 1) + 1; int distance = Math.min (deletion, Math.min(insertion, change)); = return distance; } static int distanceB (String first, String second, int len) { if(len >= first.length()) { return 0; } else { if (first.charAt(len) != second.charAt(len)) return 1 + distanceB (first, second, len+1); else return distanceB (first, second, len+1); } } Big-O distanceA Big-O distanceB Which Better
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
