sort

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2021 License: BSD-2-Clause Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FloatSlice

type FloatSlice []float32

FloatSlice attaches the methods of sort.Interface to []float32, sorting in increasing order (not-a-number values are treated as less than other values).

func (FloatSlice) Len

func (p FloatSlice) Len() int

func (FloatSlice) Less

func (p FloatSlice) Less(i, j int) bool

func (FloatSlice) Sort

func (p FloatSlice) Sort()

Sort is a convenience method.

func (FloatSlice) Swap

func (p FloatSlice) Swap(i, j int)

type Slice

type Slice struct {
	sort.Interface
	Indices []int
}

Slice is an extension of sort.Interface which keeps track of the original indices of the elements of a slice after sorting.

func NewFloatSlice

func NewFloatSlice(n ...float32) *Slice

NewFloatSlice returns a new Slice for the given sequence of float32 values.

func NewIntSlice

func NewIntSlice(n ...int) *Slice

NewIntSlice returns a new Slice for the given sequence of int values.

func NewSlice

func NewSlice(n sort.Interface) *Slice

NewSlice returns a new Slice.

func NewStringSlice

func NewStringSlice(n ...string) *Slice

NewStringSlice returns a new Slice for the given sequence of string values.

func (Slice) Swap

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

Swap swaps the elements with indexes i and j.

Jump to

Keyboard shortcuts

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