Red-Black Tree

A red-black tree is a Binary Search Tree that satisfy the red-black tree properties:

1. Every node is colored red or black;

2. If a node is red, either it is a leaf or it has two black children.

3. For any node x, every path from x to a leaf contains the same number of black nodes. This number is the black-height of x, denoted by b(x).

4. Root of T is black.

***The height of the red-black tree is at most 2logn = O(logn) height. h(x) <= 2b(x), since the red nodes' children have to be black. at most alternative.

***For any node x, the subtree(x as well as its descendents) rooted at x has at least 2b(x)-1 nodes.

原文地址:https://www.cnblogs.com/ariel-zhang/p/6898383.html