Anagram problem solution using TRIE..

For each word in dictionary we will put it in TRIE as..
 1. First sort the word
 2. Search in trie using sorted word. If search found then we will add the
original word in that TRIE node.
 3. If node node not found then using simple TRIE insertion insert sorted
word with original value stored at      last node.

For example: "CAT"

sort it => "ACT"

Search in trie with "ACT" : if node found then add "CAT" in that node.

If not found then create node with search key "ACT" store value "CAT".

Time complexity for listing all anagram :

For a given word sort it in O(L) and go to the node by traversing with
sorted word as a search key and will display all the value present at that
node.

Total time complexity : O(L) ,L = length of string


On Fri, Aug 24, 2012 at 11:18 AM, GAURAV CHAWLA <togauravcha...@gmail.com>wrote:

> Ques .... Given a large text... in the text.. there are  &gt; , &lt; etc
> representing > and <.....(there can be others like &eq;  etc)
>                the task is to replace such (&gt;) with the '>' symbol...
> and (&lt;) with '<'
>                given the table which have corresponding matches... and
> table is finite .
>               suggest an efficient algo...
>
>
>
>
>
> --
> Regards,
> G C
>
>
>
>
>  --
> 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