queuex

package
v0.0.0-...-45a4d88 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2026 License: MIT Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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