Bubble Sort
Comparison-BasedBest
O(n)
Average
O(n²)
Worst
O(n²)
Space
O(1)
Simple and educational; practical only for tiny inputs.
Unified reference for common sorting techniques with complexity, stability, memory profile, and practical usage notes.
Generally rely on pairwise element comparison.
Best
O(n)
Average
O(n²)
Worst
O(n²)
Space
O(1)
Simple and educational; practical only for tiny inputs.
Best
O(n²)
Average
O(n²)
Worst
O(n²)
Space
O(1)
Minimizes swaps, useful when writes are expensive.
Best
O(n)
Average
O(n²)
Worst
O(n²)
Space
O(1)
Very fast for nearly sorted or small datasets.
Best
O(n log n)
Average
O(n log n)
Worst
O(n log n)
Space
O(n)
Predictable performance and stable ordering.
Best
O(n log n)
Average
O(n log n)
Worst
O(n²)
Space
O(log n)
Great in practice with randomized/median pivots.
Best
O(n log n)
Average
O(n log n)
Worst
O(n log n)
Space
O(1)
Consistent upper bound and low memory footprint.
Best
O(n log n)
Average
Depends on gaps
Worst
O(n²)
Space
O(1)
Practical mid-ground between insertion and advanced sorts.
Best
O(n)
Average
O(n log n)
Worst
O(n log n)
Space
O(n)
Hybrid used in Python/Java for real-world data patterns.
Best
O(n log n)
Average
O(n log n)
Worst
O(n log n)
Space
O(log n)
Starts as quicksort, falls back to heapsort to avoid worst case.
Use key/index properties instead of direct comparisons.
Best
O(n + k)
Average
O(n + k)
Worst
O(n + k)
Space
O(k)
Excellent for bounded integer keys.
Best
O(d(n + k))
Average
O(d(n + k))
Worst
O(d(n + k))
Space
O(n + k)
Sorts by digits/characters using stable sub-sort.
Best
O(n + k)
Average
O(n + k)
Worst
O(n²)
Space
O(n + k)
Works well with uniformly distributed values.
Best
O(n + r)
Average
O(n + r)
Worst
O(n + r)
Space
O(r)
Useful when range `r` is small relative to input size.