标签:
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; } }
[Jobdu] 题目1516 : 调整数组顺序使奇数位于偶数前面
标签:
原文地址:http://www.cnblogs.com/tonyhu1993/p/4699630.html