queue

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EmptyQueueError = fmt.Errorf("Trying to pop from an empty queue")

Functions

This section is empty.

Types

type PriorityQueue

type PriorityQueue[V any] struct {
	// contains filtered or unexported fields
}

PriorityQueue uses uint priority values for queue items the priority value is inverted meaning that zero is the highest priority item and higher numbers have lower priority

func NewPriorityQueue

func NewPriorityQueue[V any]() PriorityQueue[V]

func (*PriorityQueue[V]) Add

func (this *PriorityQueue[V]) Add(priority uint, value V)

func (PriorityQueue[V]) Empty

func (this PriorityQueue[V]) Empty() bool

func (PriorityQueue[V]) Len

func (this PriorityQueue[V]) Len() int

func (*PriorityQueue[V]) Remove

func (this *PriorityQueue[V]) Remove() (V, error)

type Queue

type Queue[V any] struct {
	// contains filtered or unexported fields
}

func NewQueue

func NewQueue[V any]() Queue[V]

func (Queue[V]) Len

func (this Queue[V]) Len() int

func (*Queue[V]) Pop

func (this *Queue[V]) Pop() (V, error)

func (*Queue[V]) Push

func (this *Queue[V]) Push(values ...V)

Jump to

Keyboard shortcuts

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