pqueue

package
v0.0.2-beta Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Item

type Item[V any] struct {
	Id       string
	Value    V
	Priority int
	Index    int
}

type MaxItem

type MaxItem[V any] []*Item[V]

func (MaxItem[V]) Len

func (heap MaxItem[V]) Len() int

func (MaxItem[V]) Less

func (heap MaxItem[V]) Less(i, j int) bool

func (*MaxItem[V]) Pop

func (heap *MaxItem[V]) Pop() any

func (*MaxItem[V]) Push

func (heap *MaxItem[V]) Push(val any)

func (MaxItem[V]) Swap

func (heap MaxItem[V]) Swap(i, j int)

type PriorityQueue

type PriorityQueue[V any] struct {
	Cond *sync.Cond
	// contains filtered or unexported fields
}

func New

func New[V any]() *PriorityQueue[V]

func (*PriorityQueue[V]) At

func (queue *PriorityQueue[V]) At(index int) *Item[V]

func (*PriorityQueue[V]) Id

func (queue *PriorityQueue[V]) Id(index int) string

func (PriorityQueue[V]) IsEmpty

func (queue PriorityQueue[V]) IsEmpty() bool

func (PriorityQueue[V]) Len

func (queue PriorityQueue[V]) Len() int

func (*PriorityQueue[V]) Peek

func (queue *PriorityQueue[V]) Peek() *Item[V]

func (*PriorityQueue[V]) Pop

func (queue *PriorityQueue[V]) Pop() *Item[V]

func (*PriorityQueue[V]) Push

func (queue *PriorityQueue[V]) Push(item *Item[V])

func (*PriorityQueue[V]) Remove

func (queue *PriorityQueue[V]) Remove(index int) *Item[V]

Jump to

Keyboard shortcuts

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