Because radix sort is not O(N). It's a common misconception and luckily most modern algorithms books do not make that mistake anymore, although it seems to have been common in the past.
Radix sort is O(k * N) where k is the length of the key, and it's worth noting that there is a fundamental dependency between the length of a key and the size of a data set in that k scales with log(N), so that ultimately radix sort is O(NlogN).
So at this point it just comes down to comparing radix sort against other sorting algorithms in terms of constant factors, and radix sort certain has some use cases, but not many. One area where it excels is sorting enormous data sets that can be parallelized.
- Because it only works on integers and you need comparison for general sorting. (Wrong, you can embed basically anything you want to sort into a fixed width int)
- Wide eyes and staring silently
I like this as a filter question because:
- skips directly to, do you know CS fundimentals
- requires them to tell me I'm wrong (if they can't do that thier competency is irrelevant)
- requires that they actually think about the implications of what they were taught and reconciles them against reality.
If you don't have those qualities, you probably won't be useful as an employee or coworker.
Radix sort is O(k * N) where k is the length of the key, and it's worth noting that there is a fundamental dependency between the length of a key and the size of a data set in that k scales with log(N), so that ultimately radix sort is O(NlogN).
So at this point it just comes down to comparing radix sort against other sorting algorithms in terms of constant factors, and radix sort certain has some use cases, but not many. One area where it excels is sorting enormous data sets that can be parallelized.