minheap

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Heap

type Heap struct {
	Nodes Nodes
	K     uint32
	sync.RWMutex
}

func NewHeap

func NewHeap(k uint32) *Heap

func (*Heap) Add

func (h *Heap) Add(val Node)

func (*Heap) Find

func (h *Heap) Find(item []byte) (int, bool)

func (*Heap) Fix

func (h *Heap) Fix(idx int, count uint64)

func (*Heap) Min

func (h *Heap) Min() uint64

func (*Heap) Sorted

func (h *Heap) Sorted() Nodes

type Node

type Node struct {
	Item  []byte
	Count uint64
}

type Nodes

type Nodes []Node

func (Nodes) Len

func (n Nodes) Len() int

func (Nodes) Less

func (n Nodes) Less(i, j int) bool

func (*Nodes) Pop

func (n *Nodes) Pop() interface{}

func (*Nodes) Push

func (n *Nodes) Push(val interface{})

func (Nodes) Swap

func (n Nodes) Swap(i, j int)

Jump to

Keyboard shortcuts

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