priorityqueue

package
v1.0.0-beta.3 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2022 License: Apache-2.0, BSD-2-Clause Imports: 2 Imported by: 0

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