construct a trie.. then a simple recursion on the trie ll do ... :)  any
standard tutorial on tries ll help u build one ...

then the recursion part should look something like this,
start scanning from root of tire.

if(end of word is found)
{
   take is as a word, start searching from root of a trie + consider this as
a prefix and proceed from the current state itself
}
else
  proceed to next state

On Mon, Sep 19, 2011 at 8:20 PM, Sangeeta <sangeeta15...@gmail.com> wrote:

> given an array of characters without spaces and a dictionary.All valid
> dictionary words must be found and printed.
> i/p : BANKERKCATXYWOMAN.
> o/p: BANK
> BANKER
> CAT
> WOMAN
> MAN
> (the only function you could use for dictionary is
> dictionary.findword(char *str) which returns a Boolean value).
> Eg. Dictionary.findword(“bank”) =>true
> Dictionary.findword(“hj”) =>false
>
> --
> 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.
>
>

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