use trie trees, and for every word sort the word and store the sorted word in the trie tree and also keep the index of that word in leaf of trie tree..after traversing the whole list of words you'll have all the indices of a anagrams of a particular word in its leaf nodes.
On Fri, May 11, 2012 at 5:24 PM, mayur <[email protected]> wrote: > Hi all, > > I am stuck with a question for a long time...can someone provide the best > algorithm for this.. > > Question).. find all the anagrams in a list of words. The algorithm should > be efficient as the list can be very large. > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/algogeeks/-/c4cSIMcBYLEJ. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
