// quicksort.cpp #include "stdafx.h" #include #include #include #include // srand () #include // time () using namespace std; const int N = 1000000; int a[N]; void swap (int &x, int &y) { int z = x; x = y; y = z; } void change (int i, int j) { int z = a[i]; a[i] = a[j]; a[j] = z; } void quick (int r, int s) { int h = a[(r+s)/2]; int i = r; int j = s; // cout << "quick (" << r << "," << s << ", h=" << h<< "): "; // for (int k = r; k <= s; k++) cout << a[k] << ","; // cout << endl; while (i<=j) { while (a[i]h) j--; if (i