Documentation ¶
Index ¶
- func AverageFloat[T Number](numbers []T) float64
- func BinarySearch[T constraints.Ordered](sli []T, target T) (from, to int, hit bool)
- func CombineEvenly[T comparable](s1, s2 []T) []T
- func Copy[T any](sli []T) []T
- func CutIntoSectors[T any](sli []T, sectorLimit int) [][]T
- func Element[T any, I constraints.Signed](sli []T, signedIndex I) (value T, inRange bool)
- func Equal[T comparable](a, b []T) bool
- func HaveEqualValues[T comparable](a, b []T) bool
- func Maximum[T Number](numbers []T) T
- func Minimum[T Number](numbers []T) T
- func Reverse[T any](sli []T)
- func SetElement[T any, I constraints.Signed](sli []T, signedIndex I, value T) (inRange bool)
- func Shuffle[T any](tgt []T)
- func Sort[T any](sli []T, lessFunc func(i, j T) bool)
- func Sum[T Number](numbers []T) T
- type EqualFunc
- type LCSLink
- type LCSMap
- type List
- type Number
- type Route
- type RouteIter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BinarySearch ¶
func BinarySearch[T constraints.Ordered](sli []T, target T) (from, to int, hit bool)
BinarySearch 二分法搜索一段已排序的数
func CombineEvenly ¶
func CombineEvenly[T comparable](s1, s2 []T) []T
func CutIntoSectors ¶
CutIntoSectors 阿照 limit 分成一段一段的
func Element ¶
func Element[T any, I constraints.Signed](sli []T, signedIndex I) (value T, inRange bool)
Element 读取切片中的值, 如果是负数, 表示从最后一个 (-1) 读起。不论是正数还是负数, 如果超出 范围, 返回的 value 均无效, 并且 inRange 返回 false。
func HaveEqualValues ¶
func HaveEqualValues[T comparable](a, b []T) bool
HaveEqualValues 判断两个切片中是否拥有相同的值, 允许重复并且不考虑顺序
func SetElement ¶
func SetElement[T any, I constraints.Signed](sli []T, signedIndex I, value T) (inRange bool)
SetElement 往一个切片中设置值, 如果是负数, 表示设置在最后一个 (-1) 位置。不论是正数还是负数, 如果超出范围, 均无法设置, 并且 inRange 返回 false。
Types ¶
type LCSMap ¶
LCSMap 表示 LCS 计算结果图
Click to show internal directories.
Click to hide internal directories.