@Srikar In your first approach you cant simply ignore the queries that are not present in the heap because you have a stream of queries and you never know if the query that you are about to ignore is going be received frequently or not in future. Your approach is like find the top 100 queries from the stream and keep updating the frequencies of only those queries using heap and hash table. If you have to process some 1,00,000 , with a space for only 100 elements you cant find the frequencies correctly.
this is a nice article related to this : http://www.americanscientist.org/issues/pub/the-britney-spears-problem On Tue, Feb 1, 2011 at 8:09 PM, sankalp srivastava < richi.sankalp1...@gmail.com> wrote: > @guy above juver++ > The solution , i don't think can get better than this , because you > need to store the querries anyway (at least for the output ) > > -- > 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<algogeeks%2bunsubscr...@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.