Let's say we have some function,
float distance(String a, String b) { /*...*/ }
to find the Levenshtein distance between two strings, and we have a large array of strings.
String[] strings = new String[1_000_000];
What would be an acceptable approach to map a String a
to its closest match (i.e., the String b
that produces the lowest result of distance(a, b)
) in that array? This will need to be done often, and so going through the entire array every time would not make sense.
Of course, strings
need not be an array.