Skip to main content

Module interval_tree

Module interval_tree 

Source

Modules§

heap 🔒
stack 🔒

Structs§

IntervalBitmap
A statically allocated interval tree backed by a bitmap spanning an interval of size N. N must be a power of two. Steps are taken to treat incorrect input (rounded to nearest power).
IntervalBitmapVec
A dynamically allocated interval tree backed by a bitmap spanning an interval of size interval_size. interval_size must be a power of two. Steps are taken to treat incorrect input (rounded to nearest power).

Functions§

interval_to_bitfields
interval_to_internal
Calculates the number of internal nodes from interval size. Rounds to nearest power of two to generate a complete binary tree.
interval_to_nodes
Calculates how many nodes an interval tree should have for the given interval size. Rounds to nearest power of two to generate a complete binary tree.
leaves_to_depth
Calculates the depth of what would be a complete binary tree from the interval size.
left_child
Returns index for the left child of index. Unlike parent_for, this method is unchecked. One must track how many nodes are actually in the tree and react accordingly.
nodes_to_bitfields
Calculates with how many bitfields an interval tree should be backed by to hold the given number of nodes.
parent_for
Get parent index for an index Returns none if the node has no parent (index == 0)
right_child