▥
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
| Algorithm | Best | Avg | Worst | Space | Stable |
|---|---|---|---|---|---|
| Bubble Sort | O(n) | O(n²) | O(n²) | O(1) | Yes |
| Selection Sort | O(n²) | O(n²) | O(n²) | O(1) | No |
| Insertion Sort | O(n) | O(n²) | O(n²) | O(1) | Yes |
| Merge Sort | O(n log n) | O(n log n) | O(n log n) | O(n) | Yes |
| Quick Sort | O(n log n) | O(n log n) | O(n²) | O(log n) | No |
| Heap Sort | O(n log n) | O(n log n) | O(n log n) | O(1) | No |
| Radix Sort | O(nk) | O(nk) | O(nk) | O(n + k) | Yes |
| Shell Sort | O(n log n) | O(n log² n) | O(n²) | O(1) | No |
| Counting Sort | O(n + k) | O(n + k) | O(n + k) | O(k) | Yes |
| Cocktail Shaker | O(n) | O(n²) | O(n²) | O(1) | Yes |
All algorithms run entirely in your browser. No data is sent anywhere.