Algorithm visualizer

Watch classic sorting algorithms work through the same data.

This page generates a random array and animates how different algorithms compare, swap, and place values over time. It stays fully static, with all rendering and logic handled in plain JavaScript.

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.