Following is the scenario which i had done couple of times ..
Count the frequency of words in a paragraph.
I create a Map and store the count. SO my map contains
<Today, 10>
<the, 123>
<hello,1>
<dont, 20>
Now the other scenario comes , identifying words with count 100 or 30
I create a map of list or map of
<10, [today,...]>
<123,[the,...]>
or <10, 2> <123,1> Basically I have two maps to handle all the work.. This works fine and any update on one , the other has to be updated.
The retrieve and inserting time is almost O(1). But this is not that memory efficient.
What other approaches can be used ?