Permutation Sorting

Initializing live version
Download to Desktop

Requires a Wolfram Notebook System

Interact on desktop, mobile and cloud with the free Wolfram Player or other Wolfram Language products.

The array plots represent a permutation of a given number of bits. The challenge is to transform the permutation on the right into the randomized permutation on the left using two simple operations: "transpose top rows" and "rotate list." This represents a manual version of a rudimentary algorithm for matching a permutation's binary representation from the original state.


For example, the permutation of 3, 1, 4, 2 would require manipulation from 00, 01, 10, 11 to 10, 00, 11, 01. Note that this permutation is represented with two bits since , where is the number of bits and is the permutation length. The object of this Demonstration is to exhibit how any permutation can be achieved (even across bits) using only the two simple operations of transposition and shifting. However, in practical applications this algorithm should obviously be substantially optimized, as it is often incredibly inefficient, especially as the bit count increases.


Contributed by: Benjamin Peter (August 27)
Open content licensed under CC BY-NC-SA



Feedback (field required)
Email (field required) Name
Occupation Organization
Note: Your message & contact information may be shared with the author of any specific Demonstration for which you give feedback.