topn

package
v0.0.0-...-1ec2636 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2019 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TopN

func TopN(candidates []interface{}, less Less, n int) []interface{}

找出最大的TopN个值

Types

type GenHeap

type GenHeap struct {
	Data []interface{}
	// contains filtered or unexported fields
}

func (GenHeap) Len

func (h GenHeap) Len() int

func (GenHeap) Less

func (h GenHeap) Less(i, j int) bool

func (*GenHeap) Pop

func (h *GenHeap) Pop() interface{}

func (*GenHeap) Push

func (h *GenHeap) Push(x interface{})

func (GenHeap) Swap

func (h GenHeap) Swap(i, j int)

type Less

type Less func(small interface{}, big interface{}) bool

Less 是需要实现的比较函数

Jump to

Keyboard shortcuts

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