next up previous
Next: Properties of RB Trees Up: CSE 2320: Algorithms and Previous: Properties of RB Trees

Lemma 14.1

A RB tree with n internal nodes has height at most .

Thus the dynamic set operations on RB trees are all .



Proof:

1.
First show that subtree rooted at x contains at least 2bh(x) - 1 internal nodes.

Proof by induction.

Initial condition: if height(x) = 0, then x is a leaf whose subtree contains at least 2bh(x) - 1 = 20 - 1 = 0 internal nodes.



Inductive Step: Consider internal node x. Each child has black-height bh(x) (if the child is Red) or bh(x)-1 (if the child is Black).

By the Inductive Hypothesis, the child has at least 2bh(x)-1-1 internal nodes.

Therefore the subtree rooted at x has at least (2bh(x) - 1 - 1) + (2bh(x) - 1 - 1) + 1 internal nodes, or 2bh(x) - 1 internal nodes.



2.
Next, by property 3, a tree of height h has a black-height of at least h/2.

bh(T) $\geq$ h/2
n $\geq$ 2bh(T) - 1
n $\geq$ 2h/2 - 1, n+1 $\geq$ 2h/2
lg(n+1) $\geq$ lg(2h/2)
lg(n+1) $\geq$ h/2
h $\leq$ 2lg(n+1)


next up previous
Next: Properties of RB Trees Up: CSE 2320: Algorithms and Previous: Properties of RB Trees
Copyright © 1998 The University of Texas at Arlington