Loading section...
Counting Sort and Radix Sort — Breaking the O(n log n) Barrier
Every sorting algorithm comparison you've seen says O(n log n) is optimal. That's true — for comparison-based sorting. But if you know the range of your values, you can sort in O(n) using counting sort or radix sort. This comes up in staff DE interviews as a 'how would you optimize this ETL step?' question when the data has a bounded domain. Counting Sort — O(n + k) for Bounded Integer Ranges Radix Sort — O(d * n) for Multi-Digit Keys