priorityqueue

package
v1.0.0-rc.3 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2023 License: Apache-2.0, BSD-2-Clause Imports: 2 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PriorityQueue

type PriorityQueue[T constraints.Comparable[T]] struct {
	// contains filtered or unexported fields
}

PriorityQueue is a heap based priority queue.

func New

func New[T constraints.Comparable[T]]() (newPriorityQueue *PriorityQueue[T])

New creates a new PriorityQueue.

func (*PriorityQueue[T]) IsEmpty

func (p *PriorityQueue[T]) IsEmpty() (isEmpty bool)

IsEmpty returns true if the PriorityQueue is empty.

func (*PriorityQueue[T]) Peek

func (p *PriorityQueue[T]) Peek() (element T, success bool)

Peek returns the element with the highest priority without removing it.

func (*PriorityQueue[T]) Pop

func (p *PriorityQueue[T]) Pop() (element T, success bool)

Pop removes and returns the element with the highest priority.

func (*PriorityQueue[T]) Push

func (p *PriorityQueue[T]) Push(x T)

Push adds x to the PriorityQueue.

func (*PriorityQueue[T]) Size

func (p *PriorityQueue[T]) Size() (size int)

Size returns the number of elements in the PriorityQueue.

Jump to

Keyboard shortcuts

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