Generating lexicographic permutations with parity
For a totally-ordered set, lexicographically first and last sequences made of its elements can be defined. Every sequence is either an odd or an even number of element transpositions from the first sequence. How to keep track of the parity (even/odd)-ness of all permutations?