Skip to main content

Sorting Arena

Sort the bar array yourself using swaps, then find out how your move count compares to the theoretical minimum. Or switch to Selection Mode and execute the real algorithm round by round.

sortingswapscycle decompositionselection sortRead the lesson
How to play
  1. Click one bar, then another, to swap them (counts as one move).
  2. Sort the whole array ascending to win the round.
  3. Free Sort: any swaps work. Selection Mode: each round, click the minimum of the unsorted region.
  4. After winning, compare your moves against the optimal swap count and learn how it's computed.
modefree sortmoves0optimal≤ 3

Click one bar, then another, to swap them. Sort ascending using as few swaps as you can.

Estimated play time: 3–6 min. Scores feed your local progress, stored only in this browser.