I want to use the Levenshtein algorithm for the following task: if a user on my website searches for some value (he enters characters in a input), I want to instantly check for
There is an open-source library, java-util (https://github.com/jdereg/java-util) that has a StringUtilities.levenshteinDistance(string1, string2) API that is implemented in O(N^2) complexity and uses memory only proportional to O(N) [as discussed above].
This library also includes damerauLevenshteinDisance() as well. Damerau-Levenshtein counts the character transposition (swap) as one edit, where as proper levenshtein counts it as two edits. The downside to Damerau-Levenshtein is that it is does not have triangular equality like the original levenshtein.
Great depiction of triangular equality:
http://richardminerich.com/2012/09/levenshtein-distance-and-the-triangle-inequality/