can use a ternary tree kind of datastructure where each node will contain a pointer to the next character, It's better than trie becoz at each node rather than storing all 26 english characters or say 255 characters we only store the possible characters to the next level.
Now to get the possible combinations we can reach that level and then print all the possible words to the down of that tree..!! going left right and center.. On 2/3/12, Ravi Ranjan <[email protected]> wrote: > Implement a MS key suggest like tool where on typing the first letters will > give a list of words starting with the typed text. The corpus will be > provided as a text file. Max number of characters in a word is 10. > - Say you type 'i', it should provide 'include | if ' as the words in the > dropdown > > do it with minimum complexity??? > > less than O(n) > > -- > 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. > > -- 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.
