pq

package
v0.0.0-...-1b91a60 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2015 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

package pq implements a priority queue.

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 holds values. Values are auto orderd by their priorities.

func New

func New() *PriorityQueue

New creates a priority queue.

func (*PriorityQueue) Len

func (p *PriorityQueue) Len() int

Len returns queue size.

func (*PriorityQueue) Pop

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

Pop pops out value with minimal priority. It returns nil if no value exists.

func (*PriorityQueue) Priority

func (p *PriorityQueue) Priority(value interface{}) (priority int64, ok bool)

Priority retrieves values's priority.

func (*PriorityQueue) Push

func (p *PriorityQueue) Push(value interface{}, priority int64)

Push add a value with priority to queue.

func (*PriorityQueue) Remove

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

Remove removes the provided value from queue.

Jump to

Keyboard shortcuts

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