Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Queue ¶
type Queue[T any] struct { // contains filtered or unexported fields }
Queue is a priority queue implementation based on a binary heap. By default, the queue is a min-heap, but a custom comparator can be provided.
func New ¶
func New[T any](comparator comparison.Comparator[T]) *Queue[T]
New creates a new priority queue with the given comparator.
func NewFromIterable ¶ added in v1.6.1
func NewFromIterable[T any](comparator comparison.Comparator[T], iterable iter.Iterable[T]) *Queue[T]
NewFromIterable creates a new Queue with the given comparator and elements from the given iter.Iterable
func (*Queue[T]) PeekFront ¶
func (pq *Queue[T]) PeekFront() T
PeekFront returns the element at the front of the queue. Panics if the queue is empty.
Click to show internal directories.
Click to hide internal directories.