
public class  quickSort{
// modify the note and whitespace
// increased redundancy
	public static void main(String[] args) {
		
		int a[]={49,38,65,97,76,13,27,49,78,34,12,64,1,8};
		int l=a.length;
		//get the original data
		for(int i=0;i<l;i++)
			System.out.print(a[i]+" ");
		
		System.out.println();
		//quickSort
		if(a.length>0)
        	quick(a,0,l-1);
		//get the result
        for (int i = 0; i < l; i++) {
            System.out.print(a[i]+" ");
        }
	}
	//aaaaaaaaaaaaaaaaaaaaaaaaa.....
	private static void quick(int[] a, int low, int high) {
        if(low<high)
		{ //recursion
            int middle = getMiddle(a,low,high);//the pivot element
			
            quick(a, left, middle-1);
            quick(a, middle+1, high);
        }
    }
	private static int getMiddle(int[] a, int low, int high) {
        int temp = a[low];
        while(low<high){
            while(low<high && a[high]>=temp){
                high--;
            }
            a[low] = a[high]; 
            while(low<high && a[low]<=temp){
                low++;
            }
            a[high] = a[low];
        }
        a[low] = temp;
        return low;
    }
}
