Sorting by Reversals Demo



Goal:
The goal is to sort a permutation array to the identity permutation only by reversing subarrays of it in the minimal number of reversals.

Initialization:
Choose the size of an array, enter it in the box at the lower left corner, then click on [GO]. A random array of the chosen size will be displayed.

Sorting:
Click on two of the boxes of the array. The subarray between and including them will be reversed.

Counter:
Indicates the number of reversals.


References