Since there are no more than 83681 unique words (and there are only 5letters 
words), the simplest approach is using recursive function for words 
generation (similar to DFS).
At each step add new letter which is greater than the last added (last 
letter in the word).
Also it can be done using BFS in the same fashion.
After you've generated all words. put them into a dicitonary (set) for the 
fast searching.
P.S.
you may use also 5 nested FOR statements for the letters to add.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to