heap

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2019 License: ISC Imports: 0 Imported by: 0

Documentation

Overview

Package heap provides min heap and max heap data structures.

Deprecated: this package has been frozen and deprecated in favor of github.com/moorara/algo/ds/heap

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Heap

type Heap interface {
	Size() int
	IsEmpty() bool
	Insert(interface{}, interface{})
	Delete() (interface{}, interface{})
	Peek() (interface{}, interface{})
	ContainsKey(interface{}) bool
	ContainsValue(interface{}) bool
}

Heap represents a heap (priority queue) data structure

func NewMaxHeap

func NewMaxHeap(initialSize int, compareKey, compareValue func(a, b interface{}) int) Heap

NewMaxHeap creates a new max-heap (priority queue)

func NewMinHeap

func NewMinHeap(initialSize int, compareKey, compareValue func(a, b interface{}) int) Heap

NewMinHeap creates a new min-heap (priority queue)

Jump to

Keyboard shortcuts

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