class Solution {
public static void main(String[] args){
test aa= new test();
int[] a = {3,1,6,2,5,9,7,9};
int start = 0;
int end = a.length-1;
aa.sort(a,start,end);
for(int i = 0; i<a.length; i++){
System.out.println(a[i]);
}
}
public void sort(int a[],int low,int high) {
if(low>=high)
return;
int start = low;
int end = high;
int key = a[low];
while(end>start){
while(end>start&&a[end]>=key)
end–;
if(a[end]<=key){
a[start++]=a[end];
}
while(a[start]<key&&end>start)
start++;
if(a[start]>=key){
a[end–]=a[start];
}
}
a[start]=key;
//递归
sort(a,low,start-1);
sort(a,start+1,high);
}
}