Sort should add SliceStable

Author: AlphaWongCreated Oct 19, 2019Updated Oct 19, 2019

Hi,

I think about the sort section should have SliceStable

reference

https://golang.org/pkg/sort/#SliceStable

e.g.

go
family := []struct {
    Name string
    Age  int
}{
    {"Alice", 23},
    {"David", 2},
    {"Eve", 2},
    {"Bob", 25},
}

// Sort by age, keeping original order or equal elements.
sort.SliceStable(family, func(i, j int) bool {
    return family[i].Age < family[j].Age
})
fmt.Println(family) // [{David 2} {Eve 2} {Alice 23} {Bob 25}]

Source: polaris1119/The-Golang-Standard-Library-by-Example