pqueue

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2020 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Element

type Element interface {
	Priority() *big.Int
	GetIndex() int
	SetIndex(index int)
}

Element represents an element in the priority queue

type ElementList

type ElementList []Element

ElementList implements heap.Interface and holds Items.

func (*ElementList) IsEmpty

func (el *ElementList) IsEmpty() bool

func (ElementList) Len

func (el ElementList) Len() int

func (ElementList) Less

func (el ElementList) Less(i, j int) bool

func (*ElementList) Peek

func (el *ElementList) Peek() interface{}

func (*ElementList) Pop

func (el *ElementList) Pop() interface{}

func (*ElementList) Push

func (el *ElementList) Push(x interface{})

func (ElementList) Swap

func (el ElementList) Swap(i, j int)

type PriorityQueue

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

PriorityQueue models a priority queue (max queue). The Pop() method returns the element with the MAX priority value

func CreatePriorityQueue

func CreatePriorityQueue() *PriorityQueue

func (*PriorityQueue) ElementList

func (pq *PriorityQueue) ElementList() *ElementList

func (*PriorityQueue) IsEmpty

func (pq *PriorityQueue) IsEmpty() bool

func (*PriorityQueue) NumElements

func (pq *PriorityQueue) NumElements() int

func (*PriorityQueue) Peek

func (pq *PriorityQueue) Peek() Element

func (*PriorityQueue) Pop

func (pq *PriorityQueue) Pop() Element

func (*PriorityQueue) Push

func (pq *PriorityQueue) Push(elem Element)

func (*PriorityQueue) Remove

func (pq *PriorityQueue) Remove(index int) error

Jump to

Keyboard shortcuts

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