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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值