make a max heap of size K , and keep inserting all the elements in it.. and at last the root will be the k-th largest element ! O(nlonk)
On Thursday, 8 September 2011 22:32:52 UTC+5:30, Sandeep Chugh wrote: > > wat abt creating a max heap? and then deleting root element k-1 times.. > after then root contains kth largest element > > On Thu, Sep 8, 2011 at 10:28 PM, Piyush Kapoor <[email protected]> wrote: > >> use max heap ,it will take n + k*logn >> >> >> On Thu, Sep 8, 2011 at 10:25 PM, Rohit jalan <[email protected]> wrote: >> >>> How to find out Kth largest element in an array ? >>> >>> -- >>> Thanks & Regards : >>> ROHIT JALAN >>> >>> -- >>> 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. >>> >> >> >> >> -- >> *Regards,* >> *Piyush Kapoor,* >> *2nd year,CSE >> IT-BHU* >> >> -- >> 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 view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/XYeQcjZW-isJ. 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.
