## Documentation ¶

### Overview ¶

Package radix contains a string sorting algorithm.

This is an optimized sorting algorithm equivalent to sort.Strings. For string sorting, a carefully implemented radix sort can be considerably faster than Quicksort, sometimes more than twice as fast.

The algorithm uses O(n) extra space and runs in O(n+B) worst-case time, where n is the number of strings to be sorted and B is the number of bytes that must be inspected to sort the strings.

### Index ¶

#### Examples ¶

### Constants ¶

This section is empty.

### Variables ¶

This section is empty.

### Functions ¶

#### func Sort ¶

func Sort(a []string)

Sort sorts a slice of strings in increasing byte-wise lexicographic order.

The function is equivalent to sort.Strings in the standard library.

#### func SortSlice ¶

SortSlice sorts a slice according to the strings returned by str.

The function panics if the provided interface is not a slice.

## Example ¶

package main import ( "fmt" "github.com/yourbasic/radix" ) func main() { people := []struct { Name string Age int }{ {"Gopher", 7}, {"Alice", 55}, {"Vera", 24}, {"Bob", 75}, } radix.SortSlice(people, func(i int) string { return people[i].Name }) fmt.Println(people) }

Output: [{Alice 55} {Bob 75} {Gopher 7} {Vera 24}]

### Types ¶

This section is empty.