Crate rheap

Source
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 custom std::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§

ErrorKind
An enum containing the types of errors that a heap might encounter.

Type Aliases§

BinaryMaxHeap
A maximum heap with branching factor of 2.
BinaryMinHeap
A minimum heap with branching factor of 2.
QuaternaryMaxHeap
A maximum heap with branching factor of 4.
QuaternaryMinHeap
A minimum heap with branching factor of 4.
QuinaryMaxHeap
A maximum heap with branching factor of 5.
QuinaryMinHeap
A minimum heap with branching factor of 5.
Result
A specialized result type to make error handling simpler.
TernaryMaxHeap
A maximum heap with branching factor of 3.
TernaryMinHeap
A minimum heap with branching factor of 3.