``` void qsort(vector<int>& arr, int l, int r) { if (l >= r) return; int x = arr[l + r >> 1], i = l - 1, j = r + 1; while (i < j) { do i++; while (arr[i] < x); do j--; while (arr[j] > x); if (i < j) swap(arr[i], arr[j]); } qsort(arr, l, j), qsort(arr, j + 1, r); } ```