Expand description
rheap
is a Rust library containing an implementation of a minimum, maximum, d-way heap.
It supports:
- Maximum heaps
- Minimum heaps, without relying on
core::cmp::Reverse
or a customstd::cmp::Ord
implementation - Binary and d-way heaps. Any number of branches up to (usize::MAX - 1) / d are allowed, so use good judgement!
Use the Heap::update
method to modify the value of an element on the heap in such
a way that the element’s ordering relative to other elements is changed. Modifying
an element’s value through other means may result in a inconsistencies, logic errors,
panics, or other unintended consequences.
Structs§
- Error
- The error type used by a heap.
- Heap
- A complete binary tree in which the value of each node in the tree is either less than (in the case of a minimum heap) or greater than (in the case of a maximum heap) the value of each of its children. As a consequence, either the smallest or largest value in the tree is always located at the root of the tree.
Enums§
- Error
Kind - An enum containing the types of errors that a heap might encounter.
Type Aliases§
- Binary
MaxHeap - A maximum heap with branching factor of 2.
- Binary
MinHeap - A minimum heap with branching factor of 2.
- Quaternary
MaxHeap - A maximum heap with branching factor of 4.
- Quaternary
MinHeap - A minimum heap with branching factor of 4.
- Quinary
MaxHeap - A maximum heap with branching factor of 5.
- Quinary
MinHeap - A minimum heap with branching factor of 5.
- Result
- A specialized result type to make error handling simpler.
- Ternary
MaxHeap - A maximum heap with branching factor of 3.
- Ternary
MinHeap - A minimum heap with branching factor of 3.