heap

package
Version: v0.0.0-...-2bde968 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2020 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Appended

func Appended(h Interface)

Appended fixes the heap after a new element has been appended.

func Fix

func Fix(h Interface, index int) int

Fix fixes the heap after the item at the index was changed. It will return the new index for the given item, or -1 if the index was not in range.

func Init

func Init(h Interface)

Init constructs a heap out of the provided unordered interface.

func Remove

func Remove(h Interface, index int)

Remove moves the element at index to index h.Len()-1. This way it can be easily removed from the end of a slice.

func Update

func Update(h Interface)

Update fixes the heap after the first element has been updated.

Types

type Interface

type Interface interface {
	sort.Interface
}

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL