Swap Machine

Objective

Sort the given list by swapping the numbers in the list. You are free to select any pair of numbers you want to swap.

Experiment Setup

The Swap Machine experiment consists of a list of numbers. You can click on any number to select/deselect it. You can select at most two numbers at a time.

On selecting any two numbers, you can swap them by clicking on the 'Swap' button. The selections are reset after each swap operation.

Procedure

Follow the given steps to perform the experiment.

  1. Select first number
  2. Select second number
  3. Swap the selected numbers
  4. Check if the list is sorted or not. If the list is not sorted, then repeat steps 1 to 3.