] Re: String- Anagrams.
To: algogeeks@googlegroups.com
If you have time for pre-processing, you can do this:
for each string t in dictionary:
s = sort(t)
map[s].insert(t)
so for printing anagrams of x, we'd just print the contents of map[sort(x
If you have time for pre-processing, you can do this:
for each string t in dictionary:
s = sort(t)
map[s].insert(t)
so for printing anagrams of x, we'd just print the contents of map[sort(x)]
--~--~-~--~~~---~--~~
You received this message because you are
i think u have to print various permutations of string.
On Sun, Aug 30, 2009 at 1:02 PM, Nagendra Kumar nagendra@gmail.comwrote:
Write a method to print all valid anagrams of a string
-Nagendra
--~--~-~--~~~---~--~~
You received this message
@Anil: Dictionary is given to you. For each string t in array
u = sort(t).
if(s == u)
print (t).
If dictionary has