you can sort them(in O(n log n)) then find it . this is O(nlog n)

or you can use "selection problem" ,by this you can solve it in O(n) !  look at 
the chapter Medians and Order Statistics in CLRS book,,

--- On Thu, 7/22/10, Tech Id <[email protected]> wrote:

From: Tech Id <[email protected]>
Subject: [algogeeks] find k-th maximum in an unsorted array
To: "Algorithm Geeks" <[email protected]>
Date: Thursday, July 22, 2010, 8:53 PM

Write an algo (in less than O(n^2)) to find k-th maximum in an
unsorted array of integers.

-- 
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.

Reply via email to