priorityqueue

package
v0.0.0-...-532f06c Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2023 License: LGPL-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 Item

type Item[T any] struct {
	// contains filtered or unexported fields
}

func NewItem

func NewItem[T any](value T, priority int) *Item[T]

func (*Item[T]) Index

func (i *Item[T]) Index() int

func (*Item[T]) Value

func (i *Item[T]) Value() T

type Option

type Option[T any] func(queue *PriorityQueue[T])

func WithPreallocateSize

func WithPreallocateSize[T any](n int) Option[T]

type PriorityQueue

type PriorityQueue[T any] struct {
	// contains filtered or unexported fields
}

func NewMinPriorityQueue

func NewMinPriorityQueue[T any](options ...Option[T]) *PriorityQueue[T]

func (*PriorityQueue[T]) IsEmpty

func (p *PriorityQueue[T]) IsEmpty() bool

func (*PriorityQueue[T]) Peak

func (p *PriorityQueue[T]) Peak() *Item[T]

func (*PriorityQueue[T]) Pop

func (p *PriorityQueue[T]) Pop() *Item[T]

func (*PriorityQueue[T]) Push

func (p *PriorityQueue[T]) Push(value T, priority int) *Item[T]

func (*PriorityQueue[T]) PushItem

func (p *PriorityQueue[T]) PushItem(item *Item[T])

func (*PriorityQueue[T]) Size

func (p *PriorityQueue[T]) Size() int

func (*PriorityQueue[T]) UpdatePriority

func (p *PriorityQueue[T]) UpdatePriority(item *Item[T], priority int)

Jump to

Keyboard shortcuts

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