problemscpp
A collection of my answers to algorithm problems in c++.
静态 Public 成员函数 | 所有成员列表
acwing::acwing32::Solution类 参考

#include <acwing.h>

静态 Public 成员函数

static void reOrderArray (vector< int > &array)
 

详细描述

在文件 acwing.h1677 行定义.

成员函数说明

◆ reOrderArray()

void acwing::acwing32::Solution::reOrderArray ( vector< int > &  array)
static

在文件 acwing.cpp5169 行定义.

5169 {
5170 int l = 0;
5171 int r = array.size() - 1;
5172 while(l < r) {
5173 while(l < r && array[l] % 2 == 1) {
5174 l++;
5175 }
5176 while(l < r && array[r] % 2 == 0) {
5177 r--;
5178 }
5179 if(l < r) {
5180 swap(array[l], array[r]);
5181 }
5182 }
5183 }

该类的文档由以下文件生成: