C++의 std::next_permutation
에 의해 생성 된 순열의 parity (서명)이 만들어진 순서대로 알 수있는 간단한 방법이 있는지 궁금합니다.서명 next_permutation C++
int main()
{
int counter = 0;
std::vector<int> mask {0, 1, 2, 3, 4};
do
{
counter++;
// then determine the parity of permutation from knowledge of the counter
} while (std::next_permutation(mask.begin(), mask.end()));
}
또는 대안으로, 순열의 패리티를 결정하는 내장 함수가 있습니까?
"순열의 패리티 (서명)"란 무엇을 의미합니까? 예를 들어 줄 수 있습니까? – bolov
@bolov : https://en.wikipedia.org/wiki/Parity_of_a_permutation – Jarod42