|
|
|
|
|
by Dylan16807
2349 days ago
|
|
> What am I missing? Clearly this cannot work because otherwise everyone would do this as we accept O(NlogN) as the norm! Let's assume a perfect hash that never collides or leaves gaps, the best case for this. For a radix sort in some base with K digits, N can only go so high before you have duplicates. Specifically, base^K >= N Take the log of both sides. K >= logN So with arbitrarily large numbers the time taken to sort is actually NlogN. With fixed-size numbers it's "O(K*N)" but K is larger than logN would be. |
|
If I understand your post correctly, Radix sorts in O(log(maxsize) * N) instead of O(NlogN). So why do people say Radix Sort is O(N)?