I will go with Trie or Treap <http://en.wikipedia.org/wiki/Treap>.It will
maintin the order of words as well , we will keep incrementing count of word
if appears more then once .If we use trie to find the count it takes o(k) ,
k being length of the word
structure of trie will be like this
Class Node
{
Char Ch;
Collection <Node > LinkedList or Set;
boolean endofword(EOW);
int count;
}
Correct me if anything wrong in this ?
*
Regards
Shashank Mani "Computer Science Is Awesome So Why I Write Code"
Computer Science
Birla institute of Technology Mesra
*
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/algogeeks/-/iNjL5lpFKX0J.
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.