Algorithms‎ > ‎

Permutation

Simply put, a permutation of a set of N objects is simply an ordering of the objects into a particular sequence, where each object appears exactly once, without repetition.

If the N objects are distinct, then there are exactly N! possible permutations (where N! stands for the factorial of N, the product of all positive integers from 1 to N inclusive).

Now, mathematically, permutations can be categorized into odd permutations and evenpermutations. All permutations can be decomposed into a series of pair-wise swappings. If the N objects are distinct, then the permutations that result from an even number of swaps (even permutations) never coincide with the permutations that result from an odd number of swaps (odd permutations). Whether a permutation is even or odd, is called its parity.

While there are algorithms for determining whether a given permutation is even or odd, there do not appear to be any online resources that discuss how to enumerate all possible evenpermutations (or, for that matter, how to enumerate all odd permutations).

This page attempts to remedy that.