4 ms·
In principle, you can use radix sort for pretty much any real-world data. All you need is a canonical binary "sort key" representation, and you can implement MS
by senderista 7y ago
In principle, you can use radix sort for pretty much any real-world data. All you need is a canonical binary "sort key" representation, and you can implement MSD radix sort on top of that. (For variable-length data like strings, the sort key can be a lazy iterator in case you need to break ties for initially equal sort keys, which of course requires MSD not LSD radix sort.) Composite data types can just concatenate the sort keys of their members, recursively, much like we build hash code implementations. At some point I want to release a sorting library which introduces a new Rust trait for this purpose.