I think i hve figured out the actual answer .
Suppose we maintain a queue of N words in the memory.
With two things
1. front 2. rear
As a new word enters (recognized by a space)
-> front = front.next;
if(it is already there in the list )
++frequency of occurence;
else{
-> temp = rear;
-> rear = newWord;
-> temp.next = rear;
(simple insertion at the rear end of queue)
}
I think this will work ..
if Anyone thinks it won't then Do suggest modification or indicate
error
Pawandeep
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---