void exch(int *a,int i,int j){
int t=a[i];
a[i]=a[j];
a[j]=t;
}
int partition(int *a,int lo,int hi) {
int i=lo;//为什么这样初始化
int j=hi+1;
while(true) {
while(a[++i]<a[lo])//为什么不能<=
if(i==hi) break;//为什么这样判断
while(a[lo]<a[--j])
if(j==lo) break;//这条语句是不是多余的
if(i>=j) break;
exch(a,i,j);
}
exch(a,lo,j);
return j;
}
void sort(int *a, int lo, int hi) {
if(hi<=lo) return;
int j=partition(a,lo,hi);
sort(a,lo,j-1);
sort(a,j+1,hi);
}