[−][src]Module coca::binary_heap
A fixed-capacity priority queue implemented with a binary heap.
Insertion and popping the largest element have O(log(n)) time complexity. Checking the largest element is O(1).
BinaryHeap<E, B, I>
wraps a Vec<E, B, I>
and
can therefore be converted into the underlying vector type at zero cost.
Converting a vector to a binary heap can be done in-place, and has O(n)
complexity. A binary heap can also be converted to a sorted vector in-place,
allowing it to be used for an O(n*log(n)) in-place heapsort.
Structs
BinaryHeap | A fixed-capacity priority queue implemented with a binary heap. |
DrainSorted | A draining iterator over the elements of a |
IntoIterSorted | A consuming iterator that moves out of a |
PeekMut | Structure wrapping a mutable reference to the greatest item on a |
Type Definitions
AllocHeap | alloc A binary heap using a heap-allocated slice for storage. |
ArenaHeap | A binary heap using an arena-allocated slice for storage. |
ArrayHeap | nightly A binary heap using an inline array for storage. |
SliceHeap | A binary heap using a mutable slice for storage. |
TiArrayHeap | nightly A binary heap using an inline array for storage, generic over the index type. |