bartz.grove.tree_depths¶
- bartz.grove.tree_depths(tree_size)[source]¶
Return the depth of each node in a binary tree.
- Parameters:
tree_size (
int) – The length of the tree array, i.e., 2 ** d.- Returns:
UInt[Array, '{tree_size}']– The depth of each node.
Notes
The root node (index 1) has depth 0. The depth is the position of the most significant non-zero bit in the index. The first element (the unused node) is marked as depth 0.