go-util: github.com/vaelen/go-util/sort Index | Files

package sort

import "github.com/vaelen/go-util/sort"


Package Files

bubble.go comparators.go heap.go insertion.go merge.go quick.go registry.go selection.go sort.go template.go

func Bubble Uses

func Bubble(list []interface{}, comp Comparator)

Bubble performs an in-place bubble sort of the given list.

func Float32Comparator Uses

func Float32Comparator(a interface{}, b interface{}) int

Float32Comparator compares float32s

func Float64Comparator Uses

func Float64Comparator(a interface{}, b interface{}) int

Float64Comparator compares float64s

func Heap Uses

func Heap(list []interface{}, comp Comparator)

Heap performs an in-place heap sort of the given list.

func Insertion Uses

func Insertion(list []interface{}, comp Comparator)

Insertion performs an in-place insertion sort of the given list.

func Int16Comparator Uses

func Int16Comparator(a interface{}, b interface{}) int

Int16Comparator compares int16s

func Int32Comparator Uses

func Int32Comparator(a interface{}, b interface{}) int

Int32Comparator compares int32s

func Int64Comparator Uses

func Int64Comparator(a interface{}, b interface{}) int

Int64Comparator compares int64s

func Int8Comparator Uses

func Int8Comparator(a interface{}, b interface{}) int

Int8Comparator compares int8s

func IntComparator Uses

func IntComparator(a interface{}, b interface{}) int

IntComparator compares ints

func IsSorted Uses

func IsSorted(list []interface{}, comp Comparator) bool

IsSorted returns true if the given slice is sorted according to the given comparator

func Merge Uses

func Merge(list []interface{}, comp Comparator)

Merge performs an in-place merge sort on the given list.

func Quick Uses

func Quick(list []interface{}, comp Comparator)

Quick performs an in-place quicksort of the given list.

func Selection Uses

func Selection(list []interface{}, comp Comparator)

Selection performs an in-place selection sort of the given list.

func StringComparator Uses

func StringComparator(a interface{}, b interface{}) int

StringComparator compares strings based on code points

func Uint16Comparator Uses

func Uint16Comparator(a interface{}, b interface{}) int

Uint16Comparator compares uint16s

func Uint32Comparator Uses

func Uint32Comparator(a interface{}, b interface{}) int

Uint32Comparator compares uint32s

func Uint64Comparator Uses

func Uint64Comparator(a interface{}, b interface{}) int

Uint64Comparator compares uint64s

func Uint8Comparator Uses

func Uint8Comparator(a interface{}, b interface{}) int

Uint8Comparator compares uint8s

func UintComparator Uses

func UintComparator(a interface{}, b interface{}) int

UintComparator compares uints

type Comparator Uses

type Comparator func(a interface{}, b interface{}) int

A Comparator should compare two values of the same type. It should return 0 if they are equal, a negative number if a < b, and a positive number if a > b.

type Sort Uses

type Sort func(list []interface{}, comp Comparator)

Sort should sort the given slice in place.

Package sort imports 1 packages (graph) and is imported by 1 packages. Updated 2019-11-19. Refresh now. Tools for package owners.