4 ms·
In most cases k << n. For 64-bit integers, byte wise radix sort k is 8, which is less than log n whenever n is more than 256. So, radix sort is typically much
by bloomer 7y ago
In most cases k << n. For 64-bit integers, byte wise radix sort k is 8, which is less than log n whenever n is more than 256. So, radix sort is typically much faster than an O(n log n) sort of your data support it. It just isn’t as widely used because it is not as general as a comparison based sort.
- joshuamorton 7y agoAfter a byte-wise radix sort you still have to sort within each bucket. In the worst case, every element falls into a single bucket, at which point your best best is to do a bit wise radix sort over the low 8 bits. This ends up being equivalent to k=log(n).
- gigatexal 7y agoJumping in this fascinating thread about sorting to ask what the double less than chevrons mean? I know what one means but what do two of them mean?
- oh_sigh 7y agohttps://www.google.com/search?q=what+does+<<+mean https://www.google.com/search?q=what+does+<<+mean
- Spiritus 7y agoBasically “much less than”.
- donbindner 7y agoIn this context, it means "much less." It's used that way sometimes in mathematical discussions.
- Dylan16807 7y agoThat logic isn't right. You can implement an O(n log n) sort with whatever log base/radix you want. It could be 2, it could be 256, it could be 4096. If you use the same base/radix for both n and k, then log n is close to k and probably smaller. Which version ends up faster is mostly based on factors that big O notation doesn't capture easily. You have to push things to impractical numbers like n=2^1000 or 2^1000000 to properly distinguish between constant factors and log factors, and at that point it doesn't actually help you write better code.