i think u have to use t9 algorithm.. (tree type data structure)...
On Sat, Feb 27, 2010 at 6:32 PM, abhijith reddy <[email protected]>wrote:
> You can use a TRIE .. Structure can be something like this
>
> struct trie
> {
> int count; // no of occurences
> char *child[SIZE];
> };
>
> when ever u insert ( it will take just O(length) time) .. just increment
> count by 1
>
> For each query (also O(length) time) the no of occurrences of the word will
> be count of the last character
>
> Hope it helps
>
>
>
> On Sat, Feb 27, 2010 at 5:35 PM, <[email protected]> wrote:
>
>> Maintain a hash of word to freq. Keep adding words and incrementing their
>> frequencies while reading the documents
>>
>>
>> Pigol
>>
>>
>> On Feb 27, 2010, at 5:10 PM, vijay <[email protected]> wrote:
>>
>> You have to count the occurances of all words in a document. You are
>>> given a method chat * GetNextWord, that returns the next word from the
>>> document.
>>> - Which datastructure can be userd to achieve this
>>> -
>>>
>>> --
>>> 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]<algogeeks%[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]<algogeeks%[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]<algogeeks%[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.