asymptotic bounds of red and black tree

A red black tree which contains n internal nodes has a height of O(log(n)).


  • h(v) = height of subtree rooted at node v
  • bh(v) = the number of black nodes (not counting v if it is black) from v to any leaf in the subtree (called the black-height).

Lemma: A subtree rooted at node v has at least $$2^{bh(v)}-1$$ internal nodes.

Proof of Lemma (by induction height):

Basis: h(v) = 0

If v has a height of zero then it must be null, therefore bh(v) = 0. So:


Inductive Step: v such that h(v) = k, has at least $$ 2^{bh(v)}-1$$ internal nodes implies that v such that h(v) = k+1 has at least $$2^{bh(v’)}-1$$ internal nodes.

Since v has h(v) > 0 it is an internal node. As such it has two children each of which has a black-height of either bh(v) or bh(v)-1 (depending on whether the child is red or black). By the inductive hypothesis each child has at least $$2^{bh(v’)-1}-1$$ internal nodes, so v has at least:


internal nodes.

Using this lemma we can now show that the height of the tree is logarithmic. Since at least half of the nodes on any path from the root to a leaf are black (property 4 of a red black tree), the black-height of the root is at least h(root)/2. By the lemma we get:

$$n \geq 2^{{h(\text{root}) \over 2}} – 1 \leftrightarrow \; \log_2{(n+1)} \geq {h(\text{root}) \over 2} \leftrightarrow \; h(\text{root}) \leq 2\log_2{(n+1)}$$

Therefore the height of the root is O(log(n)).