Back to

Package prque

Latest Go to latest

The highest tagged major version is .

Published: Apr 17, 2020 | License: MIT | Module:


type Prque

type Prque struct {
	// contains filtered or unexported fields

Prque is priority queue data structure.

func New

func New(setIndex setIndexCallback) *Prque

New creates a new priority queue.

func (*Prque) Empty

func (p *Prque) Empty() bool

Empty checks whether the priority queue is empty.

func (*Prque) Pop

func (p *Prque) Pop() (interface{}, int64)

Pop pops the value with the greatest priority off the stack and returns it. Currently no shrinking is done.

func (*Prque) PopItem

func (p *Prque) PopItem() interface{}

PopItem pops only the item from the queue, dropping the associated priority value.

func (*Prque) Push

func (p *Prque) Push(data interface{}, priority int64)

Push pushes a value with a given priority into the queue, expanding if necessary.

func (*Prque) Remove

func (p *Prque) Remove(i int) interface{}

Remove removes the element with the given index.

func (*Prque) Reset

func (p *Prque) Reset()

Reset clears the contents of the priority queue.

func (*Prque) Size

func (p *Prque) Size() int

Size returns the number of element in the priority queue.

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier