5.Kth Largest Element

1.Description(Medium)

Find K-th largest element in an array.

Notice

You can swap elements in the array

Have you met this question in a real interview?

Yes

Example

In array[9,3,2,4,8], the 3rd largest element is4.

In array[1,2,3,4,5], the 1st largest element is5, 2nd largest element is4, 3rd largest element is3and etc.

Challenge

O(n) time, O(1) extra memory.

Tags

Sort Quick Sort

2.Code

https://aaronice.gitbooks.io/lintcode/content/data_structure/kth_largest_element.html

Last updated