A permutation is an ordering of every element in a finite sequence. For n distinct elements, choosing the first, second, and subsequent elements produces n! possible orderings, so the search space grows faster than exponentially. section 6.2
Permutations support several practical and combinatorial tasks:
- Generate automated test cases by checking operation orders, such as open, read, write, and close. section 6.2
- Shuffle a sequence, because a shuffle produces a new permutation of its elements. section 6.2
- Enumerate all orderings, generate a chosen position directly, or use methods such as Fisher–Yates when lexicographic enumeration is unnecessarily expensive. section 6.4
Applying a permutation
Given [cat, dog, elk, fox, hog] and the index permutation [1, 0, 2, 4, 3], select each source element by its corresponding index to obtain [dog, cat, elk, hog, fox].








