gotemplate: github.com/ncw/gotemplate/sort Index | Files

package sort

import "github.com/ncw/gotemplate/sort"

Package sort provides primitives for sorting slices of A.

Index

Package Files

sort.go

func IsSorted Uses

func IsSorted(data []A) bool

IsSorted reports whether data is sorted.

func Less Uses

func Less(a A, b A) bool

Less is a function to compare two As

func Sort Uses

func Sort(data []A)

Sort sorts data. It makes one call to data.Len to determine n, and O(n*log(n)) calls to data.Less and data.swap. The sort is not guaranteed to be stable.

type A Uses

type A int

An A is the element in the slice []A we are sorting

template type Sort(A, Less)

Updated 2018-03-10. Refresh now. Tools for package owners. This is an inactive package (no imports and no commits in at least two years).