Sorting Algorithms Visualized.
Sorting is the cornerstone of algorithmic thinking. Observe how different algorithmic strategies — selection, partitioning, divide-and-conquer, and digit bucketing — manipulate memory to arrange items in order.
8 Sorting Algorithms
Selection Sort
Finds minimum in unsorted suffix and swaps into prefix position. Minimal writes, O(n²) comparisons.
Bubble Sort
Adjacent swaps bubble largest values to the end.
Insertion Sort
Efficient for small or nearly sorted collections.
Merge Sort
Divide-and-conquer with guaranteed O(n log n) runtime.
Quick Sort
In-place partitioning with high cache locality.
Heap Sort
Priority queue mechanics with O(1) auxiliary space.
Counting Sort
Linear-time non-comparison sorting for discrete integer ranges.
Radix Sort
Digit-by-digit distribution sort.
Comparative Complexity Matrix
Asymptotic bounds across best, average, and worst execution cases along with auxiliary space guarantees.
| Algorithm | Best Time | Average Time | Worst Time | Aux Space | Stable | In-Place | Action |
|---|---|---|---|---|---|---|---|
Selection SortLIVE | O(n²) | O(n²) | O(n²) | O(1) | No | Yes | Open |
Bubble Sort | O(n) | O(n²) | O(n²) | O(1) | Yes | Yes | Soon |
Insertion Sort | O(n) | O(n²) | O(n²) | O(1) | Yes | Yes | Soon |
Merge Sort | O(n log n) | O(n log n) | O(n log n) | O(n) | Yes | No | Soon |
Quick Sort | O(n log n) | O(n log n) | O(n²) | O(log n) | No | Yes | Soon |
Heap Sort | O(n log n) | O(n log n) | O(n log n) | O(1) | No | Yes | Soon |
Counting Sort | O(n + k) | O(n + k) | O(n + k) | O(k) | Yes | No | Soon |
Radix Sort | O(d · (n + b)) | O(d · (n + b)) | O(d · (n + b)) | O(n + b) | Yes | No | Soon |
