快速排序

public static void quick_sort(int low,int high,int[]arry){
int i,j,jizhun,temp;
if (low>high){
return;
}
i = low;
j = high;
jizhun = arry[low];
while (i<j){
while (i<j&&arry[j]>=jizhun){
j--;
}
while (i<j&&arry[i]<=jizhun){
i++;
}
if (i<j){
temp = arry[j];
arry[j] = arry[i];
arry[i] =temp;
}

}
arry[low] = arry[i];
arry[i] = jizhun;
#j为基准
quick_sort(low,j-1,arry);
quick_sort(j+1,high,arry);

}
上一篇:【js】Array


下一篇:数据结构->二叉树前序、中序、后续遍历OJ题