@@ -0,0 +1,988 @@
+public class QuickSelect%0A%7B%0A    /**%0A     * @param nums Unsorted array%0A     * @param k k-th smallest element to return%0A     * @return k-th smallest element%0A     */%0A    public int quickSelect(int%5B%5D nums, int k)%0A    %7B%0A        // Boundary check omitted%0A%0A        int i = 0;%0A        int j = nums.length-1;%0A%0A        while (true)%0A        %7B%0A            int pos = partition(nums, i, j);%0A%0A            if (pos == k-1) return nums%5Bpos%5D;%0A            else if (pos %3C k-1) i = pos+1;%0A            else j = pos-1;%0A        %7D%0A    %7D%0A%0A    private int partition(int%5B%5D nums, int i, int j)%0A    %7B%0A        int pivot = nums%5Bj%5D;%0A%0A        int k = j-1;%0A        while (i %3C= k)%0A        %7B%0A            if (nums%5Bi%5D %3C= pivot) i++;%0A            else%0A            %7B%0A                swap(nums, i, k);%0A                k--;%0A            %7D%0A        %7D%0A%0A        swap(nums, i, j);%0A        return i;%0A    %7D%0A%0A    private void swap(int%5B%5D nums, int i, int j)%0A    %7B%0A        int t = nums%5Bj%5D;%0A        nums%5Bj%5D = nums%5Bi%5D;%0A        nums%5Bi%5D = t;%0A    %7D%0A%7D

Add implementation for quick select