Selection Sort
Bubble Sort
Insertion Sort
Merge Sort
Quick Sort
Comparative Analysis
| Algorithm |
Best Case |
Average Case |
Worst Case |
Space Complexity |
Stable? |
In-Place? |
| Selection Sort |
O(n²) |
O(n²) |
O(n²) |
O(1) |
No |
Yes |
| Bubble Sort |
O(n) |
O(n²) |
O(n²) |
O(1) |
Yes |
Yes |
| Insertion Sort |
O(n) |
O(n²) |
O(n²) |
O(1) |
Yes |
Yes |
| Quick Sort |
O(n log n) |
O(n log n) |
O(n²) |
O(log n) |
No |
Yes |
| Merge Sort |
O(n log n) |
O(n log n) |
O(n log n) |
O(n) |
Yes |
No |
- Stability: A sorting algorithm is stable if it preserves the relative order of equal elements.
- In-Place: All expect Merge sort algorithms are in-place, requiring no additional array storage.