Algorithm
Generate successive permutations of a sequence based on an ordering function.
See the entries for next_permutation and prev_permutation.