liveBook · Manning

Permutation

As explained in Fabulous Adventures in Data Structures and Algorithms

A permutation is an ordering of all elements of a sequence or set.

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].

How Fabulous Adventures in Data Structures and Algorithms covers it

How deep it goes
Defines permutations, derives n! growth, compares generation strategies, and demonstrates direct application while deferring full algorithm details.
Examples
Uses integer sequences, operation-order test cases, card shuffling, and a generic animal-list reordering.
What it assumes
Assumes finite sequences and basic sequence manipulation while motivating the factorial structure from element-by-element choices.
What you can do after
Apply via a C# extension method, generate test orderings, and choose an appropriate permutation-generation strategy.
How it connects
Connects permutations to combinatorics, factorials, combinations, Cartesian products, and Fisher–Yates shuffling.

Also explained in

Compare how 9 books explain permutation →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Fabulous Adventures in Data Structures and Algorithms. The section links point to the parts of the book it draws on.