@Shashank: i not sure if splay tree would always return k most frequent elements . if we want to find k most frequent elements then doing level order traversal and finding first k elements may not return k most frequent elements bcoz say if number 5 comes for the 1st time , now 5 will be the root of the tree now if we do level order traversal it print first k elements it will include number 5 which has frequency of 1.
On Wed, Dec 21, 2011 at 7:15 PM, WgpShashank <shashank7andr...@gmail.com>wrote: > @atul approach sounds good but we have to check for each time counts > updated isn't it , though even can sort the hash table & return top k > number . > also as i know we have splay tree , even google uses it , to get most > frequent item . > > > Thanks > Shashank. > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/algogeeks/-/gucYTW56cCsJ. > > 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.