Lab / Sorting Visualizer

Sorting Visualizer

Watch 10 sorting algorithms in action with animated bar charts. Race them side by side, adjust speed and array size, and hear the sort.

50
Med
Comparisons0
Swaps0
Accesses0
Time0.00s
Best: O(n log n)Avg: O(n log n)Worst: O(n²)Space: O(log n)Unstable
Complexity Reference
AlgorithmBestAvgWorstSpaceStable
Bubble SortO(n)O(n²)O(n²)O(1)Yes
Selection SortO(n²)O(n²)O(n²)O(1)No
Insertion SortO(n)O(n²)O(n²)O(1)Yes
Merge SortO(n log n)O(n log n)O(n log n)O(n)Yes
Quick SortO(n log n)O(n log n)O(n²)O(log n)No
Heap SortO(n log n)O(n log n)O(n log n)O(1)No
Radix SortO(nk)O(nk)O(nk)O(n + k)Yes
Shell SortO(n log n)O(n log² n)O(n²)O(1)No
Counting SortO(n + k)O(n + k)O(n + k)O(k)Yes
Cocktail ShakerO(n)O(n²)O(n²)O(1)Yes

All algorithms run entirely in your browser. No data is sent anywhere.