Java快排
public static void quickSort(int[] arr, int start, int end){
//递归退出条件
if(start>=end){
return;
}
int i,j,temp;
i = start;//i为头指针
j = end;//j为尾指针
temp = arr[start];//temp为轴元素
while(i<j){
//j指针先动,找到比轴元素小的元素
while(i<j && arr[j]>=temp){
j--;
}
while(i<j && arr[i]<=temp){
i++;
}
if(i<j){
arr[i]=arr[i]^arr[j];
arr[j]=arr[i]^arr[j];
arr[i]=arr[i]^arr[j];
}
}
arr[start] = arr[i];
arr[i] = temp;
quickSort(arr,j+1,end);
quickSort(arr,start,j-1);
}