快速排序
2021-02-11 04:18
标签:i++ close col closed code sed none void one 快速排序 标签:i++ close col closed code sed none void one 原文地址:https://www.cnblogs.com/zymmyz/p/12737896.html 1 void quicksort (int array[], int l, int r) {
2 if (l r) {
3 int i = l, j = r, x = array[i];
4
5 while (i j) {
6 while (i = x) {
7 j--;
8 }
9 if (i j) {
10 array[i] = array[j];
11 i++;
12 }
13
14 while (i x) {
15 i++;
16 }
17 if (i j) {
18 array[j] = array[i];
19 j--;
20 }
21 }
22 array[i] = x;
23
24 quicksort(array, l, i-1);
25 quicksort(array, i+1, r);
26 }
27 }
下一篇:python小技巧