sort

package
v0.0.0-...-4cc5765 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2022 License: MPL-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Search(n int, pred func(int) bool) int

binary search: return the smallest i < n such that pred(i) is true. assumes that pred(x) is always false up to a certain x, then always true. if pred(n-1) is false, return n.

func SearchInts

func SearchInts(data []int, x int) int

binary search: return the smallest i < len(data) such that data[i] >= x. assumes that data[] is sorted in ascending order. if data[len(data)-1] < x, return n

func Sort

func Sort(data Interface)

func Strings

func Strings(data []string)

Types

type Interface

type Interface interface {
	Len() int
	Less(i int, j int) bool
	Swap(i int, j int)
}

Jump to

Keyboard shortcuts

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