queuex

package
v0.0.0-...-e837ca6 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Comparable

type Comparable[T any] = ekit.Comparator[T]

type PriorityQueue

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

func NewPriorityQueue

func NewPriorityQueue[T any](cap int, cmp Comparable[T]) *PriorityQueue[T]

NewPriorityQueue creates a new priority queue with the given capacity and comparator. cmp if a > b return -1 then 小顶堆

func (*PriorityQueue[T]) All

func (q *PriorityQueue[T]) All() []T

All after call this method, the queue will be empty

func (*PriorityQueue[T]) Enqueue

func (q *PriorityQueue[T]) Enqueue(v T)

type ZQueue

type ZQueue[S cmp.Ordered, V any] struct {
	// contains filtered or unexported fields
}

func NewZQueue

func NewZQueue[S cmp.Ordered, V any](cap int) *ZQueue[S, V]

func (*ZQueue[S, V]) All

func (q *ZQueue[S, V]) All() []ZQueueItem[S, V]

func (*ZQueue[S, V]) AllValues

func (q *ZQueue[S, V]) AllValues() []V

func (*ZQueue[S, V]) Enqueue

func (q *ZQueue[S, V]) Enqueue(score S, value V)

type ZQueueItem

type ZQueueItem[S cmp.Ordered, V any] struct {
	Score S
	Value V
}

Jump to

Keyboard shortcuts

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