6 лет назад
История
README.md
This repository contains radix sort algorithm implementation in Go.
LSD sort is a bit tuned in terms of performance.
Numeric sort.
type MyType int64
func (t MyType) OrderN() int64 {
return int64(t)
}
...
var list []radixsort.NumericOrder
radixsort.SortNumericOrder(list)
// 12, -8, 2, 4, 1, 5, -2, 7 => -8, -2, 1, 2, 4, 5, 7, 12
Lexicographical sort.
type MyType string
func (t MyType) OrderL() []byte {
return []byte(t)
}
...
var list []radixsort.LexicographicalOrder
radixsort.SortLexicographicalOrder(list)
// "c", "a", "ba", "ab", "bb", "aaa" => "a", "aaa", "ab", "ba", "bb", "c"
Usage of, for example, insertion sort for lexicographical order for small lists is not done. It is actually not planned to be used for small arrays. Feel free to fork and adapt the code.
Конвейеры
0 успешных
0 с ошибкой