how about this O(nm) solution?
first create a 26 length int array
for each word, store the number of times each character appears in the word,
in the above 26 length array O(m)...
Insert this value in a trie (insertion=O(m))... example if the sorted string
contains a-4times, b-3 times, c-2 times, d 5 times, then store
aaaabbbccddddd in the trie...
while inserting in the trie, if the values repeat, then it is an anagram...

-- 
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.

Reply via email to