restrictedDamerauDistance<E> function

int restrictedDamerauDistance<E>(
  1. List<E> source,
  2. List<E> target, {
  3. DualEqualityTest<E, E>? test,
})

Finds the restricted Damerau-Levenshtein edit distance between two lists using Wagner–Fischer algorithm

Parameters

  • source and target are two list of items.
  • test is 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);
}