Generation of Permutations According to Sedgewick





Reference: Sedgewick, Algorithms p.628.