A RB tree with n internal nodes has height at most 2*lg(n+1).

Thus the dynamic set operations on RB trees are all O(lgn).

**Proof:**

- 1.
- First show that subtree rooted at
*x*contains at least 2^{bh(x)}- 1 internal nodes.Proof by induction.

**Initial condition:**if height(x) = 0, then x is a leaf whose subtree contains at least 2^{bh(x)}- 1 = 2^{0}- 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 2

^{bh(x)-1}-1 internal nodes.Therefore the subtree rooted at

*x*has at least (2^{bh(x) - 1}- 1) + (2^{bh(x) - 1}- 1) + 1 internal nodes, or 2^{bh(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) h/2n 2^{bh(T)}- 1n 2^{h/2}- 1, n+1 2^{h/2}lg(n+1) lg(2^{h/2})lg(n+1) h/2h 2lg(n+1)