just look at the cormen's 9th chapter in 3rd edition.. randomized_select procedure is exactly suitable for this.. it is less complex than heapify procedures and all actually it is of modification of quick sort and u guys ll appreciate that..
On Sat, Sep 10, 2011 at 3:12 PM, a.maiskar <[email protected]> wrote: > why evaryone is thinking about heap...we can use selection algorithm > and find the n-k smallest element in that. this will take O(n) time > > On Sep 10, 1:23 pm, Kunal Patil <[email protected]> wrote: > > @Dave: TC in your first case will be O(klogn + n). > > Transforming array into heap would be O(n). > > Correct me If i am wrong. > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
