Watch arrays get ordered — comparisons, swaps, and partitions animated step by step.
14 visualizations
Repeatedly swaps adjacent out-of-order elements, bubbling the largest to the end each pass.
Repeatedly selects the smallest remaining element and moves it to the front, using at most n−1 swaps.
Builds a sorted prefix one element at a time, shifting larger elements right to open a slot for each key.
Recursively splits the array in half, sorts each half, then merges them — guaranteed O(n log n).
Partitions around a pivot so smaller elements go left and larger go right, then recurses on each side.
Builds a max-heap in the array, then repeatedly swaps the root maximum to the end and re-heapifies.
Generalizes insertion sort by comparing elements a shrinking gap apart, moving them long distances early.
Counts occurrences of each key and uses prefix sums to place elements directly — O(n + k), no comparisons.
Sorts integers digit by digit from least to most significant, using a stable bucket pass for each digit.
A bidirectional bubble sort that alternates forward and backward passes, sorting from both ends inward.
Improves bubble sort by comparing elements a shrinking gap apart, eliminating small trailing values fast.
Scatters values into range-based buckets, sorts each bucket internally, then concatenates — fast when input is uniformly distributed.
The hybrid behind Python's and Java's default sort: insertion-sort small runs, then merge them like merge sort — stable and fast on partially-sorted data.
Sorts using only 'flip the first k elements' operations — find the max, flip it to the front, then flip it to its final position.