void adjustArray(int a[], int n) { int low = 0, high = n - 1; int pivot; while (low < high) { while (a[high] % 2 == 0 && low < high) high--; while (a[low] % 2 == 1 && low < high) low++; pivot = a[low]; a[low] = a[high]; a[high] = pivot; } }
时间: 2024-10-27 16:53:47