pq

package
v0.0.0-...-e714f23 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Prioritizer

type Prioritizer interface {
	Priority() int
}

Items in a PriorityQueue must implement the Priority interface.

type PriorityQueue

type PriorityQueue[T Prioritizer] struct {
	// contains filtered or unexported fields
}

PriorityQueue provides a priority queue based on container/heap.

An update method is missing because doing that requires access to the item to fix the heap after an item changes value.

func New

func New[T Prioritizer]() *PriorityQueue[T]

func (*PriorityQueue[T]) Len

func (q *PriorityQueue[T]) Len() int

func (*PriorityQueue[T]) Pop

func (q *PriorityQueue[T]) Pop() T

func (*PriorityQueue[T]) Push

func (q *PriorityQueue[T]) Push(t T)

Jump to

Keyboard shortcuts

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