Do we have to partition after finding the kth element ? Will the Array not be partitioned when the base condition is met ?
Amal. On 3/16/07, Rajiv Mathews <[EMAIL PROTECTED]> wrote: > > > On 3/16/07, Karthik Singaram L <[EMAIL PROTECTED]> wrote: > > > > How would the median algorithm get the top k elements? > > > > I think what he meant was, use the median by parting-in-5 algorithm to > find the kth largest element. This can be done in O(n). > Then just partition around this element to get the top k elements, O(n). > > -- > > > Regards, > Rajiv Mathews > > > > --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/algogeeks -~----------~----~----~----~------~----~------~--~---