·data
Sorting Algorithm Visualizer
Bubble, insertion, selection, quick, merge — watch five classic sorts run live as a bar chart. Step / play / 1×–16× speed. Comparison, swap and sorted states color-coded.
algorithms · sorting · visualization
Bubble, insertion, selection, quick, merge — watch five classic sorts run live as a bar chart. Step / play / 1×–16× speed. Comparison, swap and sorted states color-coded.
algorithms · sorting · visualization
Knowing sorting algorithms is one thing; seeing them is another. Quicksort's partitioning, merge sort's divide-and-conquer, bubble sort's slowness — visible.
| Algorithm | Best | Avg | Worst | Stable | In-place |
|---|---|---|---|---|---|
| Bubble | O(n) | O(n²) | O(n²) | ✓ | ✓ |
| Insertion | O(n) | O(n²) | O(n²) | ✓ | ✓ |
| Selection | O(n²) | O(n²) | O(n²) | ✗ | ✓ |
| Quick | O(n log n) | O(n log n) | O(n²) | ✗ | ✓ |
| Merge | O(n log n) | O(n log n) | O(n log n) | ✓ | ✗ |
JS's Array.prototype.sort() uses TimSort (insertion + merge hybrid) in modern engines. Best case O(n) on already-sorted data, worst case O(n log n).