215.Kth Largest Element in an Array

  有兩種思路,一種是快速排序法,一種是優先隊列(最小堆)。 快排:  public class Solution { public int findKthLargest(int[] a, int k) { int n = a.length; int p = quickSelect(a, 0, n - 1, n - k + 1); return a[p]; }
相關文章
相關標籤/搜索