utils

package
v0.0.0-...-cf38f87 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2017 License: Apache-2.0 Imports: 0 Imported by: 1

Documentation

Overview

sort is copied from stdlib, most functions made public to support generic sorters.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DoPivot

func DoPivot(data LessSwap, lo, hi int) (midlo, midhi int)

Auto-generated variant of sort.go:doPivot

func HeapSort

func HeapSort(data LessSwap, a, b int)

Auto-generated variant of sort.go:heapSort

func InsertionSort

func InsertionSort(data LessSwap, a, b int)

Auto-generated variant of sort.go:insertionSort

func MaxDepth

func MaxDepth(n int) int

MaxDepth returns a threshold at which quicksort should switch to heapsort. It returns 2*ceil(lg(n+1)).

func MedianOfThree

func MedianOfThree(data LessSwap, m1, m0, m2 int)

Auto-generated variant of sort.go:medianOfThree

func QuickSort

func QuickSort(data LessSwap, a, b, maxDepth int)

Auto-generated variant of sort.go:quickSort

func Rotate

func Rotate(data LessSwap, a, m, b int)

Auto-generated variant of sort.go:rotate

func SiftDown

func SiftDown(data LessSwap, lo, hi, first int)

Auto-generated variant of sort.go:siftDown

func Stable

func Stable(data LessSwap, n int)

Auto-generated variant of sort.go:stable

func SwapRange

func SwapRange(data LessSwap, a, b, n int)

Auto-generated variant of sort.go:swapRange

func SymMergeFunc

func SymMergeFunc(data LessSwap, a, m, b int)

Auto-generated variant of sort.go:symMerge

Types

type LessSwap

type LessSwap struct {
	Less func(i, j int) bool
	Swap func(i, j int)
}

Jump to

Keyboard shortcuts

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