math

constants

variables

functions


math/big


math/cmplx


math/rand


sort

functions

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
func Ints(a []int)
func IntAreSorted(a []int) bool
func SearchInts(a []int, x int) int

func Float64s(a []float64)
func Float64sArerSorted(a []float64) bool
func SearchFloat64s(a []float64, x float64) int

func Strings(a []string)
func StringsAreSorted(a []string) bool
func SearchStrings(a []string, x string) int

func Sort(data Interface)
func Stable(data Interface)
func IsSorted(data Interface) bool
func Reverse(data Interface) Interface
// 二分查找
func Search(n int, f func(int) bool) int

Interface

1
2
3
4
5
type Interface interface {
    Len() int
    Less(i, j int) bool
    Swap(i, j int)
}

InitSlice

1
type InitSlice []int

Float64Slice

1
type Float64Slice []float64

StringSlice

1
type StringSlice []string