This code takes in a scrambled input word and gives out the unscrambled list of words.
Eg... Input = time
Output = mite, item, emit etc.
I had posted an unscrambler in java sometime ago. This one is the improvement over the previous one. In the sense, the java unscrambler took an input word, and produced all permutations of the input word, did a binary search of each permutation on the list of available words. The problem was that if the input word is sufficiently large, it would produce an OutOfMemory error, because the permutations would be large.
The improvement is that this one, maintains a dictionary of the the available set words whose key is a word with the letters sorted in ascending order as key and the value is a list of all the words that have the same letters as the key.
Eg... Key = eimt, Value = [time, mite, emit, item].
Attaching the code.
Edited 6 Years Ago by giri.pankaj: n/a