A CAT algorithm for generating permutations with a fixed number of inversions

We develop a constant amortized time (CAT) algorithm for generating permutations with a given number of inversions. We also develop an algorithm for the generation of permutations with given index.