Skip to main content

Module priority_queue

Module priority_queue 

Source
Expand description

Heap-based priority queue with an explicit allocator.

ExPriorityQueue implements a binary heap whose ordering is determined by a caller-supplied OrdContext<T>. Depending on whether the context implements a min-ordering or a max-ordering, the queue acts as a min-heap or a max-heap respectively.

§Complexity

OperationComplexity
pushO(log n) amortised
popO(log n)
peekO(1)
push_sliceO(n) via rebuild
rebuildO(n)

§Growth Policy

The initial capacity is 4; subsequent growth doubles the capacity.

Structs§

ExPriorityQueue
A binary-heap priority queue backed by an explicit allocator.