Permutation
A permutation is a bijective rearrangement of the elements of a finite set, equivalently an ordering in which each element appears exactly once.
Statistics Every Programmer Needs
A permutation without replacement is an ordered arrangement in which each item may be selected at most once.
- How it is used
- Counts possible outcomes when a probability problem selects items in a meaningful order.
- How deep it goes
- Defines order and replacement, derives the factorial count through shrinking choices, and computes an example in Python.
- Examples
- Uses briefcase-lock sequences and a five-item, three-position calculation yielding 60 arrangements.
- What you can do after
- Apply it via Python’s math.perm to count ordered selections without replacement and check whether repetition is allowed.
Read how Statistics Every Programmer Needs explains permutation →
Statistics Slam Dunk
A permutation without replacement is an ordered arrangement in which a selected element cannot be selected again.
- How it is used
- Frames NBA rest analysis by determining whether prior-days-off groupings require permutations or combinations.
- How deep it goes
- Defines ordering and replacement, distinguishes formulas conceptually, and computes or prints arrangements without developing formal derivations.
- Examples
- Uses NBA lineups, standings, lottery selections, coach play calls, and home-away rest pairings.
- What you can do after
- Apply it via gtools to count and print ordered arrangements for an NBA data analysis.
Optimization Algorithms: AI techniques for design, planning, and control problems
A permutation is an ordered arrangement of elements in which each element appears exactly once.
- How it is used
- Frames permutations as discrete decision structures for combinatorial optimization and route-ordering problems.
- How deep it goes
- Defines order and repetition, then works through permutation encoding, tour-cost calculation, and optimizer parameters.
- Examples
- Uses fitness-plan selections, city tours, distance matrices, Python functions, and a twenty-city PSO route.
- What you can do after
- Apply it via PySwarms by encoding candidate orders, evaluating tour distances, and converting the best position into a route.
Fabulous Adventures in Data Structures and Algorithms
A permutation is an ordering of all elements of a sequence or set.
- How it is used
- Uses reorderings to generate test cases, shuffle sequences, and study finite combinatorial structures.
- 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 you can do after
- Apply via a C# extension method, generate test orderings, and choose an appropriate permutation-generation strategy.
Read how Fabulous Adventures in Data Structures and Algorithms explains permutation →
Classic Computer Science Problems in Swift: Essential techniques for practicing programmers
A permutation is an ordering of the elements of a collection in which each element appears exactly once.
- How it is used
- Uses exhaustive orderings to evaluate candidate routes in the traveling salesman problem.
- How deep it goes
- Explains recursive swapping, base cases, in-place mutation, and backtracking, without developing permutation theory or performance analysis.
- Examples
- Demonstrates permutations with three letters, Vermont cities, distance tables, and closed traveling-salesman routes.
- What you can do after
- Build all permutations in Swift and apply them to exhaustive route evaluation or constrained word generation.
Advanced Algorithms and Data Structures
A permutation is an arrangement of the elements of a sequence in which each element occurs exactly once.
- How it is used
- Models candidate routes for traveling-salesperson optimization and encodes solutions for simulated annealing and genetic algorithms.
- How deep it goes
- Defines the representation, cost calculation, symmetry pruning, initialization, and transition operators, but not permutation theory beyond optimization.
- Examples
- Uses six-city and ten-vertex tours, explicit city sequences, cost landscapes, random initialization, swaps, and random-permutation transitions.
- What you can do after
- Build candidate TSP solutions, calculate closed-tour costs, prune equivalent arrangements, and select search transitions.
Read how Advanced Algorithms and Data Structures explains permutation →
Real-World Cryptography
A permutation is a reversible one-to-one mapping of a set of elements onto itself.
- How it is used
- Clarifies reversible mappings underlying SHA-3 and keyed block-cipher encryption.
- How deep it goes
- Defines one-to-one reversibility and connects it to SHA-3 and AES, but stops short of designing the underlying permutations.
- Examples
- Uses four shapes, all possible 8-bit strings, and 128-bit AES plaintext-ciphertext mappings.
- What you can do after
- Understand how reversible mappings support hashing and encryption constructions.
Quantum Programming in Depth
A permutation is an arrangement containing each member of a finite set exactly once.
- How it is used
- Reduces the candidate space for a Grover-based N queens solver by excluding repeated column indices.
- How deep it goes
- Contrasts N^N with N!, quantifies the N = 4 improvement, and notes the harder state preparation without deriving its circuit.
- Examples
- Uses column-index encodings for N queens and compares the four-queen spaces of 256 unrestricted inputs and 24 permutations.
- What you can do after
- Evaluate/understand how permutation-based encodings reduce Grover iterations while complicating equal-superposition preparation.
Read how Quantum Programming in Depth explains permutation →
Get Programming: Learn to code with Python
A permutation is an arrangement of selected items in which order distinguishes the arrangement.
- How it is used
- Uses permutations to reason about differently ordered lists and possible arrangements of Scrabble tiles.
- How deep it goes
- Defines permutations with list examples and exercises, but stops short of implementing the permutation-checking function.
- Examples
- Uses integer lists with reordered and repeated values, plus Scrabble tiles whose letters could form valid words.
- What you can do after
- Apply the concept by checking whether two lists contain identical elements with identical counts despite different ordering.
Read how Get Programming: Learn to code with Python explains permutation →
Timeless Algorithms, The Foundational Ideas
A permutation is an arrangement of objects or outcomes in which order matters.
- How it is used
- Distinguishes the probability of one ordered sequence from the probability of outcome totals in any order.
- How deep it goes
- Explains ordered trial sequences and contrasts them with combinations, but does not develop a general permutation-counting formula.
- Examples
- Uses a heads-and-tails sequence and coin denominations to distinguish ordered outcomes from combinations counted once.
- What you can do after
- Understand how order changes the event being counted and why a recurrence may count reorderings only once.
Read how Timeless Algorithms, The Foundational Ideas explains permutation →
Also covered in
- Learn Haskell by Example
- Ensemble Methods for Machine Learning
- Clojure: The Essential Reference
- Build a Robo-Advisor with Python (From Scratch)
What to know first
- integerAn integer is a whole-number mathematical value, including negative numbers, zero, and positive numbers, with no fractional part.
- combinationA combination is a selection of elements in which the order of selection does not matter.
- distanceA distance function assigns a numerical measure of separation or dissimilarity to pairs of points or objects in a defined space.
- optimizationOptimization is the systematic selection or modification of values, configurations, or implementations to improve a defined objective, often subject to constraints.
Related concepts
- combinationcontrasts with · A combination is a selection of elements in which the order of selection does not matter.
- permutation with replacementincludes · A permutation with replacement is an ordered selection in which each item remains available for subsequent selection.
- keccak-fincludes · keccak-f is the fixed-size permutation used as the internal transformation in SHA-3.
- search spacepart of · A search space is the set of possible states, choices, configurations, or candidate solutions that may be considered when exploring or solving a problem.
- shuffleproduced by · Shuffling is the random rearrangement of elements in a collection or sequence.
- sequenceuses · A sequence is an ordered collection of elements whose positions determine the order in which they are arranged or traversed.
Questions about permutation
What is permutation?
A permutation is a bijective rearrangement of the elements of a finite set, equivalently an ordering in which each element appears exactly once.
Which Manning books explain permutation?
Statistics Every Programmer Needs, Statistics Slam Dunk, Optimization Algorithms: AI techniques for design, planning, and control problems, Fabulous Adventures in Data Structures and Algorithms, Classic Computer Science Problems in Swift: Essential techniques for practicing programmers, Advanced Algorithms and Data Structures, Real-World Cryptography, Quantum Programming in Depth and 2 more.
What should I know before learning permutation?
Manning books that teach permutation usually introduce integer, combination, distance and optimization first.
What is the difference between permutation and combination?
A permutation is a bijective rearrangement of the elements of a finite set, equivalently an ordering in which each element appears exactly once. A combination is a selection of elements in which the order of selection does not matter.
What kinds of permutation are there?
Kinds of permutation include permutation with replacement and keccak-f.
What is permutation part of?
Permutation is part of search space. A search space is the set of possible states, choices, configurations, or candidate solutions that may be considered when exploring or solving a problem.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.









