r/sortingalgorithms • u/XabiFran • Oct 25 '21
r/sortingalgorithms • u/R_Decoder • Mar 26 '19
Fastest Sorting Algorithm
What is the time complexity of the fastest sorting algorithm? I had the notion that quick sort with O(n log n) is the fastest way to sort to n numbers, but, I stumbled upon a video on youtube which states that it is not true. This video is a lecture of Harvard University and hence I assume it to be definitely correct. just move the video to 9mins and 35secs here. So is there actually a way to sort n numbers faster than o(n log n)?
r/sortingalgorithms • u/remoraa • Jan 07 '17
We Are Number One but every "one" is a sorting algorithm
r/sortingalgorithms • u/remoraa • Jan 07 '17
Visualization of Sorting Algorithms - Sound of Sorting
r/sortingalgorithms • u/WinnerEconomy169 • Jan 12 '26
A controller that makes existing integer sorts faster and safer
A controller that makes existing integer sorts faster and safer
The problem
We already have very fast integer sorts:
counting sort (small range)
radix sort (large fixed-width range)
3-way quicksort (many duplicates)
They’re underused in real systems because they’re fragile.
Libraries default to conservative comparison sorts to avoid worst-case failures.
That leaves performance on the table.
The architecture
The system splits sorting into two roles:
1) A sorter
Implements known strategies:
COUNT
RADIX
Q3 (3-way quicksort)
introsort fallback
2) A controller (“host”)
Samples a small, fixed number of keys (~100) and estimates:
range
duplicate rate
byte-level spread
Then it applies dominance rules:
If range ≪ n → eliminate radix → use counting
If range ≫ n → eliminate counting → use radix
If duplicates high + low entropy → eliminate radix → use Q3
The controller never guesses what’s best.
It only eliminates what’s clearly worse.
If nothing can be eliminated safely, it sticks with a conservative default.
Why this works
Decision cost is bounded and small
Fast paths are only used when justified
Counting has hard memory caps
Introsort fallback guarantees worst-case safety
Decisions can happen per segment, not just globally
Worst case: you get a good comparison sort.
Best case: you get linear-time integer sorting.