Levenshtein Distance is a canonical method where it takes two strings, and returns a number representing the minimum number of insertions, deletions and replacements required to translate one string into the other.

Distances Example :

  •     LevenshteinDistance(cook, book) -> 1
  •     LevenshteinDistance(cook, books) -> 2
  •     LevenshteinDistance(what, water) -> 3

Usage:

  • BK-trees can be used for approximate string matching in a dictionary.
  • Levenshtein distance – the distance metric commonly used when building a BK-tree