| ▲ | SkiFire13 5 hours ago | |||||||||||||||||||||||||||||||
> Only if you assume a finite alphabet and bounded length You can generally reduce the problem to a finite alphabet by taking the finite subset that actually appears in the input. If you have an unbounded length then you can make sorting O(l n) where `l` is a bound on the lengths of your input. It's still linear in n, and also better than the O(l n logn) you would with traditional comparison based algorithms once you factor in the O(l) complexity of the comparison function for such elements. | ||||||||||||||||||||||||||||||||
| ▲ | amluto 5 hours ago | parent | next [-] | |||||||||||||||||||||||||||||||
> O(l n) If you don’t have large numbers of repeats of each element, then l needs to scale like O(log n), so O(l * n) is at least O(n log n). Fundamentally, what’s going on here is that switching between computation models can easily add and remove log factors. | ||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||
| ▲ | CaptainNegative 3 hours ago | parent | prev [-] | |||||||||||||||||||||||||||||||
> You can generally reduce the problem to a finite alphabet by taking the finite subset that actually appears in the input. You can generally sort any array in constant time by taking that constant to be the time it takes to sort the array using bubble sort. | ||||||||||||||||||||||||||||||||