heap

package
v0.0.0-...-3865ccb Latest Latest
Warning

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

Go to latest
Published: May 23, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MaxHeap

type MaxHeap struct {
	Comparator base.CompareFunc
	// contains filtered or unexported fields
}

func New

func New(Comparator base.CompareFunc) *MaxHeap

func (*MaxHeap) Empty

func (h *MaxHeap) Empty() bool

Empty returns true if heap does not contain any elements.

func (*MaxHeap) Peek

func (h *MaxHeap) Peek() interface{}

Peek returns the top element of heap, or nil if heap is empty.

func (*MaxHeap) Pop

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

Pop removes the max (top) element and returns it, or nil if heap is empty.

func (*MaxHeap) Push

func (h *MaxHeap) Push(key interface{})

Push adds a value onto the heap.

func (*MaxHeap) Size

func (h *MaxHeap) Size() int

Size returns number of elements within the heap.

Jump to

Keyboard shortcuts

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