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
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
Is this amazon question buddy??
On Fri, May 11, 2012 at 5:24 PM, mayur mayursa...@gmail.com 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
if asking me..yes !!
On Fri, May 11, 2012 at 5:27 PM, Raghavendhra Chowdary MV
raghavendhra20061...@gmail.com wrote:
Is this amazon question buddy??
On Fri, May 11, 2012 at 5:24 PM, mayur mayursa...@gmail.com wrote:
Hi all,
I am stuck with a question for a long time...can someone provide
what we can do is ,... lets have a array of 25 prime nos ..
and corresponding to its index no. i.e a :0 ,b:1,c:3..
now
we traverse each word and generate a count of each word .. and if count
for any two or three are same will be anagrams..
hope this will work..
give comments plz...
On