package com.algorithms.sorting;


public class Quick {}

@@ -47,10 +47,886 @@
  Quick %7B
+%0A%0A    public void sort(Comparable%5B%5D a) %7B sort(a, 0, a.length-1); %7D%0A%0A    private static void sort(Comparable%5B%5D a, int lo, int hi) %7B%0A        if (hi %3C= lo) return;%0A        int part = partition(a, lo, hi);%0A        sort(a, lo, part-1);%0A        sort(a, part+1, hi);%0A    %7D%0A%0A    private static int partition(Comparable%5B%5D a, int lo, int hi) %7B%0A        int i = lo, j = j = hi+1;%0A        while (true) %7B%0A            while (less(a%5B++i%5D, a%5Blo%5D)) if (i == hi) break;%0A            while (less(a%5Blo%5D, a%5B--j%5D)) if (j == lo) break;%0A%0A            if (i %3E= j) break;%0A            exch(a, i , j);%0A        %7D%0A%0A        exch(a, lo, j);%0A        return j;%0A    %7D%0A%0A    private static boolean less(Comparable v, Comparable w) %7B%0A        return v.compareTo(w) %3C 0;%0A    %7D%0A%0A    private static void exch(Comparable%5B%5D a, int i, int j) %7B%0A        Comparable swap = a%5Bi%5D;%0A        a%5Bi%5D = a%5Bj%5D;%0A        a%5Bj%5D = swap;%0A    %7D%0A
 %7D%0A

Create Quick Sort