RBNode depth bounds #
O(n)
. depth t
is the maximum number of nodes on any path to a leaf.
It is an upper bound on most tree operations.
Equations
- Batteries.RBNode.nil.depth = 0
- (Batteries.RBNode.node c a v b).depth = max a.depth b.depth + 1
Instances For
depthLB c n
is the best upper bound on the depth of any balanced red-black tree
with root colored c
and black-height n
.
Equations
Instances For
depthUB c n
is the best upper bound on the depth of any balanced red-black tree
with root colored c
and black-height n
.
Equations
- Batteries.RBNode.depthUB Batteries.RBColor.red x✝ = 2 * x✝ + 1
- Batteries.RBNode.depthUB Batteries.RBColor.black x✝ = 2 * x✝