indexpriorityqueue

package
v0.0.0-...-118f76d Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IndexPriorityQueue

type IndexPriorityQueue[T any] interface {
	// Size gets number of elements in a queue.
	Size() int
	// Insert adds element to a queue.
	Insert(key int, element T)
	// Remove removes element from a queue.
	Remove() (T, int)
	// Peek returns first element of a queue.
	Peek() T
	// RemoveByKey removes element by key.
	RemoveByKey(key int) T
	// PeekKey returns first element key.
	PeekKey() int
	// HasKey tells if key exists.
	HasKey(key int) bool
}

IndexPriorityQueue is index priority queue data structure.

func New

func New[T any](less LessFunc[T]) IndexPriorityQueue[T]

New creates instance of IndexPriorityQueue

type LessFunc

type LessFunc[T any] func(lhs, rhs T) bool

LessFunc is an ordering function.

Jump to

Keyboard shortcuts

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