gothonHeapq

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HeapPop

func HeapPop[T Number](arr *[]T) T

Pop and return the smallest item from the heap, maintaining the heap invariant. Receives a pointer from a slice Changes are made in place

func HeapPush

func HeapPush[T Number](arr *[]T, val T)

Push the value item onto the heap, maintaining the heap invariant. Receives a pointer from a slice and a value to be pushed. Changes are made in place

func HeapPushPop

func HeapPushPop[T Number](arr *[]T, val T) T

Push item on the heap, then pop and return the smallest item from the heap. Receives a pointer from a slice and a value to be pushed. Changes are made in place

func Heapify

func Heapify[T Number](arr *[]T)

Transform list x into a heap, in-place. Receives a pointer from a slice.Changes are made in place

Types

type Heap

type Heap[T Number] struct {
	// contains filtered or unexported fields
}

type Number

type Number interface {
	constraints.Integer | constraints.Float
}

This interface restrict variables that can be set in generics.

Jump to

Keyboard shortcuts

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