priorityq

package
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2021 License: AGPL-3.0 Imports: 1 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 struct {
	// contains filtered or unexported fields
}

PriorityQueue represents the queue

func (*PriorityQueue) Insert

func (p *PriorityQueue) Insert(v interface{}, priority float64) (duplicate bool)

Insert inserts a new element into the queue. No action is performed on duplicate elements.

func (*PriorityQueue) Len

func (p *PriorityQueue) Len() int

Len returns the number of elements in the queue.

func (*PriorityQueue) Peek

func (p *PriorityQueue) Peek() (interface{}, bool)

Peek returns the item that is on top of the heap but does not remove. In case of an empty queue, false is returned.

func (*PriorityQueue) Pop

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

Pop removes the element with the highest priority from the queue and returns it. In case of an empty queue, nil is returned.

func (*PriorityQueue) Remove

func (p *PriorityQueue) Remove(x interface{})

Remove removes the element.

func (*PriorityQueue) UpdatePriority

func (p *PriorityQueue) UpdatePriority(x interface{}, newPriority float64)

UpdatePriority changes the priority of a given item. If the specified item is not present in the queue, no action is performed.

Jump to

Keyboard shortcuts

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