Sorting playground

Same numbers, different ways of putting them in order.

This is a visual way to compare algorithms I had mostly seen in code or diagrams. Pick a few sorts, change the bar count, and watch where the simple approaches start to struggle.

Array size

Animation speed

Algorithms to run

Sound effects

Bubble sort

Bubble

Ready

Time: --

Memory: --

Bubble sort repeatedly compares neighboring values and swaps them when they are out of order, slowly pushing larger values to the end.

Selection sort

Selection

Ready

Time: --

Memory: --

Selection sort scans the remaining unsorted values to find the smallest item, then places it into the next sorted position.

Insertion sort

Insertion

Ready

Time: --

Memory: --

Insertion sort builds a sorted section from left to right, inserting each new value into the correct place among the items before it.

Merge sort

Merge

Ready

Time: --

Memory: --

Merge sort splits the array into smaller pieces, sorts those pieces, and then merges them back together in order.

Quick sort

Quick

Ready

Time: --

Memory: --

Quick sort chooses a pivot, partitions smaller and larger values around it, and then recursively sorts each side.

Heap sort

Heap

Ready

Time: --

Memory: --

Heap sort organizes values into a max heap, repeatedly removes the largest value, and places it at the end of the array.

Shell sort

Shell

Ready

Time: --

Memory: --

Shell sort improves insertion sort by first comparing values across larger gaps, then reducing the gap until the array is fully sorted.

Radix sort

Radix

Ready

Time: --

Memory: --

Radix sort groups numbers by individual digits from least significant to most significant instead of comparing values directly.