Definition: Generate permutations by transposing one pair of elements at a time.

Also known as Steinhaus-Johnson-Trotter.

Generalization (I am a kind of ...)

See also Fisher-Yates shuffle, Gray code.

Author: PEB

More information

Hale F. Trotter, Perm (Algorithm 115), CACM, 5(8):434-435, August 1962.
Selmer M. Johnson, Generation of Permutations by Adjacent Transposition, Mathematics of Computation, 17(83):282-285, July 1963. Also available at

Go to the Dictionary of Algorithms and Data Structures home page.

If you have suggestions, corrections, or comments, please get in touch with Paul Black.

Entry modified 25 February 2019.
HTML page formatted Wed Mar 13 12:42:46 2019.

Cite this as:
Paul E. Black, "Johnson-Trotter", in Dictionary of Algorithms and Data Structures [online], Paul E. Black, ed. 25 February 2019. (accessed TODAY) Available from: