# 【Leetcode】Kth Largest Element in an Array

Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.

For example,
Given [3,2,1,5,6,4] and k = 2, return 5.

Note:
You may assume k is always valid, 1 ≤ k ≤ array's length.

1、快排，时间复杂度O(nlogn)

2、分冶..用快排划分，递归的划分。每一次划分都可以去确定一个元素的位置，也就知道比该元素小的元素数目。目测时间复杂度最差为 O(n^2)，最好为O(1)，平均？没动力做了......待做

public int findKthLargest(int[] nums, int k) {
Arrays.sort(nums);
return nums[nums.length-k];
}


#### LeetCode215:Kth Largest Element in an Array

2015-07-09 21:36:41

#### LeetCode OJ 215. Kth Largest Element in an Array 堆排序求解

2016-02-23 14:00:40

#### leetcode 215: Kth Largest Element in an Array

2015-05-29 08:47:21

#### [leetcode] 215. Kth Largest Element in an Array 解题报告

2016-02-21 07:29:34

#### 【LeetCode-面试算法经典-Java实现】【215-Kth Largest Element in an Array（数组中第K大的数）】

2015-08-28 06:57:17

#### leetcode 215 Kth Largest Element in an Array C++

2016-12-05 15:54:02

#### LeetCode 215:Kth Largest Element in an Array

2015-05-27 00:11:33

#### 215. Kth Largest Element in an Array-Python

2017-07-07 17:42:28

#### leetcode 230. Kth Smallest Element in a BST-递归|非递归

2016-05-24 11:17:50

#### 【LeetCode】215. Kth Largest Element in an Array，基于Java和C++的解法

2016-05-31 11:40:47