标签:快速排序 ret col quick nbsp code style color while
void swap(int &a, int &b) { int t = a; a = b; b = t; } int Quick(int a[], int l, int r) { if(l >= r) return 0; int x = a[l]; int i = l; int j = r; while(i < j){ while(a[j] > x && j > i) j--; while(a[i] <=x && j > i) i++; if(j > i){ swap(a[i], a[j]); } } if(l < i){ swap(a[l], a[i]); } Quick(a, l, i-1); Quick(a, i+1, r); }
标签:快速排序 ret col quick nbsp code style color while
原文地址:https://www.cnblogs.com/Jie-Fei/p/10576136.html