here find popular post means to find most repeated cost....so we can use combination of max-heap and hashtable.
hashtable is required to keep track for distinct cost. so if cost is not present in hashtable then add it to the hashtable and then add it to the Max-heap with counter value =1...then hepify. next time we find that cost in hashtable then we just need to increment counter of that cost in heap and thne hepify.At any point of time ...element at the top is the element with popular cost. On 5/31/12, g4ur4v <gauravyadav1...@gmail.com> wrote: > How to find popular cost of the books, > say > book1 $10 > book2 $20 > book3 $40 > book4 $50 > book5 $10 > book6 $20 > > > http://www.careercup.com/question?id=13720752 > > -- > 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. > > -- 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.