heap

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MinHeap

type MinHeap struct {
	// contains filtered or unexported fields
}

A basic int heap Accepts no size as we dynamically resize the heap in a slice fashion. Otherwise it is an ordinary MinHeap. Example:

	1
  5   3
9  6 8

Arr form: 1 3 6 5 9 8

func (*MinHeap) InsertNode

func (h *MinHeap) InsertNode(node ...int) *MinHeap

Insert a node into the heap

func (*MinHeap) LeftChildIndex

func (h *MinHeap) LeftChildIndex(parentNodeIndex int) int

Get left child index for a given node index

func (*MinHeap) ParentIndex

func (h *MinHeap) ParentIndex(childIndex int) int

Gets parent index for a given node

func (*MinHeap) RightChildIndex

func (h *MinHeap) RightChildIndex(parentNodeIndex int) int

Get right child index for a given node index

func (*MinHeap) String

func (h *MinHeap) String() string

Jump to

Keyboard shortcuts

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