Sorting algorithms rearrange a collection into order, but they do it very differently. Bubble sort compares neighbours and swaps repeatedly; insertion sort grows a sorted prefix; merge sort divides, sorts recursively, and merges. The visualization animates the array as bars, with comparisons and swaps highlighted.
Sorting algorithms and how they differ| Algorithm | Best | Average | Worst | Space |
|---|
| Bubble | O(n) | O(n²) | O(n²) | O(1) |
| Insertion | O(n) | O(n²) | O(n²) | O(1) |
| Merge | O(n log n) | O(n log n) | O(n log n) | O(n) |
| Quick | O(n log n) | O(n log n) | O(n²) | O(log n) |