sortutil

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2017 License: Apache-2.0, BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Overview

Package sortutil provides utilities supplementing the standard 'sort' package.

Changelog

2015-06-17: Added utils for math/big.{Int,Rat}.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dedupe

func Dedupe(data sort.Interface) (n int)

Dedupe returns n, the number of distinct elements in data. The resulting elements are sorted in elements [0, n) or data[:n] for a slice.

func SearchBigInts

func SearchBigInts(a []*big.Int, x *big.Int) int

SearchBigInts searches for x in a sorted slice of *big.Int and returns the index as specified by sort.Search. The slice must be sorted in ascending order.

func SearchBigRats

func SearchBigRats(a []*big.Rat, x *big.Rat) int

SearchBigRats searches for x in a sorted slice of *big.Int and returns the index as specified by sort.Search. The slice must be sorted in ascending order.

func SearchBytes

func SearchBytes(a []byte, x byte) int

SearchBytes searches for x in a sorted slice of bytes and returns the index as specified by sort.Search. The slice must be sorted in ascending order.

func SearchFloat32s

func SearchFloat32s(a []float32, x float32) int

SearchFloat32s searches for x in a sorted slice of float32 and returns the index as specified by sort.Search. The slice must be sorted in ascending order.

func SearchInt16s

func SearchInt16s(a []int16, x int16) int

SearchInt16s searches for x in a sorted slice of int16 and returns the index as specified by sort.Search. The slice must be sorted in ascending order.

func SearchInt32s

func SearchInt32s(a []int32, x int32) int

SearchInt32s searches for x in a sorted slice of int32 and returns the index as specified by sort.Search. The slice must be sorted in ascending order.

func SearchInt64s

func SearchInt64s(a []int64, x int64) int

SearchInt64s searches for x in a sorted slice of int64 and returns the index as specified by sort.Search. The slice must be sorted in ascending order.

func SearchInt8s

func SearchInt8s(a []int8, x int8) int

SearchInt8s searches for x in a sorted slice of int8 and returns the index as specified by sort.Search. The slice must be sorted in ascending order.

func SearchRunes

func SearchRunes(a []rune, x rune) int

SearchRunes searches for x in a sorted slice of uint64 and returns the index as specified by sort.Search. The slice must be sorted in ascending order.

func SearchUint16s

func SearchUint16s(a []uint16, x uint16) int

SearchUint16s searches for x in a sorted slice of uint16 and returns the index as specified by sort.Search. The slice must be sorted in ascending order.

func SearchUint32s

func SearchUint32s(a []uint32, x uint32) int

SearchUint32s searches for x in a sorted slice of uint32 and returns the index as specified by sort.Search. The slice must be sorted in ascending order.

func SearchUint64s

func SearchUint64s(a []uint64, x uint64) int

SearchUint64s searches for x in a sorted slice of uint64 and returns the index as specified by sort.Search. The slice must be sorted in ascending order.

func SearchUints

func SearchUints(a []uint, x uint) int

SearchUints searches for x in a sorted slice of uints and returns the index as specified by sort.Search. The slice must be sorted in ascending order.

Types

type BigIntSlice

type BigIntSlice []*big.Int

BigIntSlice attaches the methods of sort.Interface to []*big.Int, sorting in increasing order.

func (BigIntSlice) Len

func (s BigIntSlice) Len() int

func (BigIntSlice) Less

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

func (BigIntSlice) Sort

func (s BigIntSlice) Sort()

Sort is a convenience method.

func (BigIntSlice) Swap

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

type BigRatSlice

type BigRatSlice []*big.Rat

BigRatSlice attaches the methods of sort.Interface to []*big.Rat, sorting in increasing order.

func (BigRatSlice) Len

func (s BigRatSlice) Len() int

func (BigRatSlice) Less

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

func (BigRatSlice) Sort

func (s BigRatSlice) Sort()

Sort is a convenience method.

func (BigRatSlice) Swap

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

type ByteSlice

type ByteSlice []byte

ByteSlice attaches the methods of sort.Interface to []byte, sorting in increasing order.

func (ByteSlice) Len

func (s ByteSlice) Len() int

func (ByteSlice) Less

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

func (ByteSlice) Sort

func (s ByteSlice) Sort()

Sort is a convenience method.

func (ByteSlice) Swap

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

type Float32Slice

type Float32Slice []float32

Float32Slice attaches the methods of sort.Interface to []float32, sorting in increasing order.

func (Float32Slice) Len

func (s Float32Slice) Len() int

func (Float32Slice) Less

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

func (Float32Slice) Sort

func (s Float32Slice) Sort()

Sort is a convenience method.

func (Float32Slice) Swap

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

type Int16Slice

type Int16Slice []int16

Int16Slice attaches the methods of sort.Interface to []int16, sorting in increasing order.

func (Int16Slice) Len

func (s Int16Slice) Len() int

func (Int16Slice) Less

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

func (Int16Slice) Sort

func (s Int16Slice) Sort()

Sort is a convenience method.

func (Int16Slice) Swap

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

type Int32Slice

type Int32Slice []int32

Int32Slice attaches the methods of sort.Interface to []int32, sorting in increasing order.

func (Int32Slice) Len

func (s Int32Slice) Len() int

func (Int32Slice) Less

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

func (Int32Slice) Sort

func (s Int32Slice) Sort()

Sort is a convenience method.

func (Int32Slice) Swap

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

type Int64Slice

type Int64Slice []int64

Int64Slice attaches the methods of sort.Interface to []int64, sorting in increasing order.

func (Int64Slice) Len

func (s Int64Slice) Len() int

func (Int64Slice) Less

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

func (Int64Slice) Sort

func (s Int64Slice) Sort()

Sort is a convenience method.

func (Int64Slice) Swap

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

type Int8Slice

type Int8Slice []int8

Int8Slice attaches the methods of sort.Interface to []int8, sorting in increasing order.

func (Int8Slice) Len

func (s Int8Slice) Len() int

func (Int8Slice) Less

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

func (Int8Slice) Sort

func (s Int8Slice) Sort()

Sort is a convenience method.

func (Int8Slice) Swap

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

type RuneSlice

type RuneSlice []rune

RuneSlice attaches the methods of sort.Interface to []rune, sorting in increasing order.

func (RuneSlice) Len

func (s RuneSlice) Len() int

func (RuneSlice) Less

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

func (RuneSlice) Sort

func (s RuneSlice) Sort()

Sort is a convenience method.

func (RuneSlice) Swap

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

type Uint16Slice

type Uint16Slice []uint16

Uint16Slice attaches the methods of sort.Interface to []uint16, sorting in increasing order.

func (Uint16Slice) Len

func (s Uint16Slice) Len() int

func (Uint16Slice) Less

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

func (Uint16Slice) Sort

func (s Uint16Slice) Sort()

Sort is a convenience method.

func (Uint16Slice) Swap

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

type Uint32Slice

type Uint32Slice []uint32

Uint32Slice attaches the methods of sort.Interface to []uint32, sorting in increasing order.

func (Uint32Slice) Len

func (s Uint32Slice) Len() int

func (Uint32Slice) Less

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

func (Uint32Slice) Sort

func (s Uint32Slice) Sort()

Sort is a convenience method.

func (Uint32Slice) Swap

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

type Uint64Slice

type Uint64Slice []uint64

Uint64Slice attaches the methods of sort.Interface to []uint64, sorting in increasing order.

func (Uint64Slice) Len

func (s Uint64Slice) Len() int

func (Uint64Slice) Less

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

func (Uint64Slice) Sort

func (s Uint64Slice) Sort()

Sort is a convenience method.

func (Uint64Slice) Swap

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

type UintSlice

type UintSlice []uint

UintSlice attaches the methods of sort.Interface to []uint, sorting in increasing order.

func (UintSlice) Len

func (s UintSlice) Len() int

func (UintSlice) Less

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

func (UintSlice) Sort

func (s UintSlice) Sort()

Sort is a convenience method.

func (UintSlice) Swap

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

Jump to

Keyboard shortcuts

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