queue

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package queue provided a generic priority queue implemtation based on the internal heap

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PriorityQueue

type PriorityQueue struct {
	// contains filtered or unexported fields
}

PriorityQueue implemented using a heap

func NewPriorityQueue

func NewPriorityQueue(cmpFunc func(interface{}, interface{}) bool) *PriorityQueue

NewPriorityQueue creates a new heap based PriorityQueue using cmpFunc as the comparison function

func (*PriorityQueue) Len

func (pq *PriorityQueue) Len() int

Len returns the number of items in the queue

func (*PriorityQueue) Peek

func (pq *PriorityQueue) Peek() interface{}

Peek returns the next item in the queue without removing it

func (*PriorityQueue) PeekUpdate

func (pq *PriorityQueue) PeekUpdate()

PeekUpdate reorders the backing heap with the new values

func (*PriorityQueue) Pop

func (pq *PriorityQueue) Pop() interface{}

Pop removes and returns the next item in the queue

func (*PriorityQueue) Print

func (pq *PriorityQueue) Print()

Print prints the current ordered queue

func (*PriorityQueue) Push

func (pq *PriorityQueue) Push(x interface{})

Push adds x to the queue

Jump to

Keyboard shortcuts

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