I added a function radix.SortSlice similar to sort.Slice. Instead of a
comparison function, it takes a function that serves the relevant strings:
// SortSlice sorts a slice according to the strings returned by str.
func SortSlice(slice interface{}, str func(i int) string) {
The performance
That's an interesting challenge! What the algorithm really does is to first
find a permutation that will sort the string slice, and then apply this
permutation to the slice. Perhaps it would be possible to return this
permutation in some cheap usable format.
On Tuesday, June 13, 2017 at 7:56:54
That's really nice!
Consider a case where I am sorting a slice of structs, but the underlying
sort is based on a string within the structs. Or, with some other radixable
datatype besides strings.
Can we figure out an interface (similar to sort.Interface) which would
permit a solution for either o
It's well known that radix sort can be faster than comparison-based methods
for string sorting. With that in mind, I wrote this optimized version of
MSD radix sort:
https://github.com/yourbasic/radix
It's equivalent to sort.Strings in the standard library and on my machine
it's twice as fa