Class StringEditDistance


  • public class StringEditDistance
    extends Object
    • Method Detail

      • editDistance

        public static int editDistance​(String a,
                                       String b)
        Computes the edit distance between two strings.

        The complexity is O(nm) where n=a.length() and m=b.length().

        Parameters:
        a -
        b -
        Returns:
      • findNearest

        public static String findNearest​(String key,
                                         String[] group)
        Finds the string in the group closest to key and returns it.
        Parameters:
        key -
        group -
        Returns:
        null if group.length==0.