The Steinhaus-Johnson-Trotter algorithm, also called the Johnson-Trotter algorithm or plain changes, is an algorithm named after Hugo Steinhaus, Selmer M. Johnson and Hale F. Trotter that generates all permutations of n elements so that each two adjacent permutations in the resulting sequence differ by swapping two adjacent elements. The method was already known to seventeenth century English change ringers, and Robert Sedgewick called it perhaps the most prominent permutation enumeration algorithm; a version can be implemented so that the average time per permutation is constant.
Facts
Time Complexity
Time Complexity (category)Factorial Time -- O(n!) 1 Classification
Design Technique Connections
In Field
Source Steinhaus-Johnson-Trotter algorithm (Wikipedia)
Uses Design Technique
Entity-backed identity for the design-technique enum value this algorithm already carries, resolved to a computing concept by an explicit value-to-entity map (phase 3 bucket conversion, docs\design_entity_backed_browse_buckets_20260928.md). The design-technique fact itself stays on the algorithm unchanged.
Sources
1. Steinhaus-Johnson-Trotter Algorithm (Wikipedia)
Wikipedia infobox: time complexity factorialQuote, Wikipedia infobox: time complexity factorial
factorial
View the Source Steinhaus-Johnson-Trotter algorithm (Wikipedia)
Reader Challenges (0)
No disputes yet. Spotted an error or a better source? Open the first one.
Sign in to dispute this or suggest a correction.