Explore and compare 18+ sorting algorithms with interactive visualizations.
Watch algorithms sort in real-time with step-by-step animations
Repeatedly steps through the list, compares adjacent elements and swaps them if in wrong order.
Divides array into sorted and unsorted regions, repeatedly selects smallest element.
Builds the final sorted array one item at a time by inserting each element into correct position.
Divide and conquer algorithm that divides array into halves, sorts and merges them back.
Selects a pivot element and partitions the array around it, then recursively sorts partitions.
Builds a max heap from the array and repeatedly extracts the maximum element.
| Algorithm | Best | Average | Worst | Space | Stable |
|---|---|---|---|---|---|
| Bubble Sort | O(n) | O(n²) | O(n²) | O(1) | ✓ |
| Selection Sort | O(n²) | O(n²) | O(n²) | O(1) | ✗ |
| Insertion Sort | O(n) | O(n²) | O(n²) | O(1) | ✓ |
| Merge Sort | O(n log n) | O(n log n) | O(n log n) | O(n) | ✓ |
| Quick Sort | O(n log n) | O(n log n) | O(n²) | O(log n) | ✗ |
| Heap Sort | O(n log n) | O(n log n) | O(n log n) | O(1) | ✗ |