Sorting Contest — Algorithms

A sorting algorithm contest: 15 levels of bubble, insertion, selection, merge and quick sort. The most instructive visual sorting game.

What you learn in this game

Bubble Sort compares two adjacent elements. If the left one is larger, swap. If not, skip. The largest element "bubbles" to the right.

Selection Sort finds the smallest element in the rest of the array, then swaps it into the correct position. Scan from left to right to find the minimum.

Insertion Sort takes one element, then inserts it into the correct position in the already-sorted part (the left side). Like sorting cards in your hand.

What the levels ask

  1. Sort this array using Bubble Sort: swap or skip?
  2. This array is almost sorted; it just needs finishing.
  3. The array is in reverse order, so expect lots of swaps.
  4. Sort 5 elements with bubble sort.
  5. One more bubble sort.
  6. Use Selection Sort: find the smallest element.
  7. Selection sort on 5 elements.
  8. Selection sort a longer array.
  9. The sorting is almost done. Finish it.
  10. One more selection sort.
  11. Use Insertion Sort: insert the element into the correct position.
  12. Sort them like cards in your hand.

And more, 15 levels in all.