priorityqueue

package
v4.7.2 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: MIT Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BinHeap

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

func NewBinHeap

func NewBinHeap[T Item](maxLen uint64) *BinHeap[T]

func (*BinHeap[T]) Exists added in v4.3.1

func (bh *BinHeap[T]) Exists(id string) bool

func (*BinHeap[T]) ExtractMin

func (bh *BinHeap[T]) ExtractMin() T

func (*BinHeap[T]) Insert

func (bh *BinHeap[T]) Insert(item T)

func (*BinHeap[T]) Len

func (bh *BinHeap[T]) Len() uint64

func (*BinHeap[T]) PeekPriority added in v4.1.0

func (bh *BinHeap[T]) PeekPriority() int64

PeekPriority returns the highest priority

func (*BinHeap[T]) Remove added in v4.2.0

func (bh *BinHeap[T]) Remove(groupID string) []T

Remove removes all elements with the provided ID and returns the slice with them

type Item

type Item interface {
	// Unique ID of the item
	ID() string
	// Priority returns the Item's priority to sort
	Priority() int64
	// GroupID represents the Item's group, used to delete all Items with the same GroupID
	GroupID() string
}

Item represents binary heap item

Jump to

Keyboard shortcuts

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