> For the complete documentation index, see [llms.txt](https://junnie.gitbook.io/nine-chapter/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://junnie.gitbook.io/nine-chapter/8.data-structure/5kth-largest-element.md).

# 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 is`4`.

In array`[1,2,3,4,5]`, the 1st largest element is`5`, 2nd largest element is`4`, 3rd largest element is`3`and etc.

[**Challenge**](https://www.lintcode.com/en/problem/kth-largest-element/#challenge)

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

[**Tags**](https://www.lintcode.com/en/problem/kth-largest-element/#tags)

[Sort](https://www.lintcode.com/tag/sort/) [Quick Sort](https://www.lintcode.com/tag/quick-sort/)

## 2.Code

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