xsort

package
v1.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 2, 2021 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Int64QuickSort

func Int64QuickSort(s []int64)

Int64QuickSort 对[]int64快速排序

func Int64StableSort

func Int64StableSort(s []int64)

Int64StableSort 对[]int64稳定排序 从小到大,当元素相同时候,保持原有index顺序

func Slice

func Slice(s interface{}, less func(i, j int) bool)

Slice 对s切片类型的数据进行排序,当出现相同元素的话,采用快速排序 The sort is not guaranteed to be stable. For a stable sort, use SliceStable.

func SliceStable

func SliceStable(s interface{}, less func(i, j int) bool)

SliceStable 对切片类型的s进行稳定排序 SliceStable sorts the provided slice given the provided less function while keeping the original order of equal elements. The function panics if the provided interface is not a slice.

Types

type Int64Slice

type Int64Slice []int64

Int64Slice int64类型的切片排序

func NewInt64Slice

func NewInt64Slice(s []int64) Int64Slice

NewInt64Slice 创建一个int64切片排序slice

func (Int64Slice) Len

func (s Int64Slice) Len() int

Len return len

func (Int64Slice) Less

func (s Int64Slice) Less(i, j int) bool

Less less

func (Int64Slice) Swap

func (s Int64Slice) Swap(i, j int)

Swap swap

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL