标签:排序 class public -- 快速 code div bre int
public void quickSort(int left, int right, int a[]) { int l = left; int r = right; int pivot = a[(l + r) / 2];// 转轴数 int temp = 0; while (l < r) { while (a[l] < pivot) l++; while (a[r] > pivot) r--; if (l >= r) break; temp = a[l]; a[l] = a[r]; a[r] = temp; if (a[l] == pivot) r--; if (a[r] == pivot) l++; } if (l == r) { l++; r--; } if (left < r) quickSort(left, r, a); if (right > l) quickSort(l, right, a); }
标签:排序 class public -- 快速 code div bre int
原文地址:http://www.cnblogs.com/johnsonwei/p/6041258.html