restrictedDamerauDistance<E> function
Finds the restricted Damerau-Levenshtein edit distance between two lists using Wagner–Fischer algorithm
Parameters
sourceandtargetare two list of items.testis an optional equality matcher.
Details
This functions returns the minimum number of these operations required to
transform source into target without modifying their contents.
Check restrictedDamerauDistanceOf for further details.
If n is the length of source and m is the length of target,
Complexity: Time O(nm) | Space O(3m)
Implementation
int restrictedDamerauDistance<E>(
List<E> source,
List<E> target, {
DualEqualityTest<E, E>? test,
}) {
if (test == null) {
return restrictedDamerauDistanceDefault(source, target);
}
return restrictedDamerauDistanceCustom(source, target, test);
}