@@ -0,0 +1,1292 @@
+/**%0A *%0A * O(N) best case / O(N%5E2) worst case running time + O(1) memory%0A * The smart approach for this problem is to use the selection algorithm %0A * (based on the partion method - the same one as used in quicksort).%0A * %0A * https://leetcode.com/discuss/36966/solution-explained%0A */%0Apublic class Solution %7B%0A    public int findKthLargest(int%5B%5D nums, int k) %7B%0A%0A        k = nums.length - k;%0A        int lo = 0;%0A        int hi = nums.length - 1;%0A        while (lo %3C hi) %7B%0A            final int j = partition(nums, lo, hi);%0A            if(j %3C k) %7B%0A                lo = j + 1;%0A            %7D else if (j %3E k) %7B%0A                hi = j - 1;%0A            %7D else %7B%0A                break;%0A            %7D%0A        %7D%0A        return nums%5Bk%5D;%0A    %7D%0A%0A    private int partition(int%5B%5D a, int lo, int hi) %7B%0A%0A        int i = lo;%0A        int j = hi + 1;%0A        while(true) %7B%0A            while(i %3C hi && less(a%5B++i%5D, a%5Blo%5D));%0A            while(j %3E lo && less(a%5Blo%5D, a%5B--j%5D));%0A            if(i %3E= j) %7B%0A                break;%0A            %7D%0A            exch(a, i, j);%0A        %7D%0A        exch(a, lo, j);%0A        return j;%0A    %7D%0A%0A    private void exch(int%5B%5D a, int i, int j) %7B%0A        final int tmp = a%5Bi%5D;%0A        a%5Bi%5D = a%5Bj%5D;%0A        a%5Bj%5D = tmp;%0A    %7D%0A%0A    private boolean less(int v, int w) %7B%0A        return v %3C w;%0A    %7D%0A%7D%0A

Create Kth_Largest_Element_in_an_Array.java