!!!Chapter 12 Advanced Data Structure and Implementation
来源:互联网 发布:好用的补水乳液 知乎 编辑:程序博客网 时间:2024/05/17 06:58
12.2 Red Black Tree
Operations on red black trees take O(logN) time in the worst case, and a careful nonrecursive implementation can be done relatively effortlessly.
A red black tree is a binary search tree with the following coloring properties:
1. Every node is colored either red or black.
2. The root is black.
3. If a node is red, its children must be black.
4. Every path from a node to a NULL pointer must contain the same number of black nodes.
(5). All leaves (NULL node) are black.
The height of a red black tree is at most 2log(N+1). Height of AVL tree & red black tree:http://en.wikipedia.org/wiki/AVL_tree
12.2.1 Bottom-Up Insertion
When insert a new node, it must be red. Otherwise, it will break rule 4. When we add a red node, there are two scenarios:
1. The parent node is black: In this case, we are done
2. The parent node is red: In this case, we need to change color and rotate tree
- !!!Chapter 12 Advanced Data Structure and Implementation
- Chapter 12 CPU Structure and Function
- Best data structure for dictionary implementation
- algorithm and data structure
- algorithm and data structure
- Data Structure and Algorithm
- Chapter 11: Using Menu-Based Controls--Defining menu structure and data
- Chapter 11: Using Menu-Based Controls Defining menu structure and data
- chapter 12 Data Files and Persistence
- Advanced FPGA Design: Architecture, Implementation, and Optimization
- android data structure And algorithm
- Algorithm and Data Structure Review
- [Data Structure and Algorithm]--Heap
- Chapter 09–Storage Structure and Relationships
- Chapter 7. Advanced DirectDraw and Bitmapped Graphics
- Chapter 1. General Unix and Advanced C
- [zt] hashing table and Data Structure tutorial
- Structure Member Alignment, Padding and Data Packing
- JDBC事务管理
- 校招季——编程题目(6-7)
- jQuery的validate验证插件使用方法
- 重构手法30:Replace Type Code with Class (以类取代类型码)
- Velocity语法
- !!!Chapter 12 Advanced Data Structure and Implementation
- map set multimap multiset 对键值快速查找 插入 删除 O(logN)
- 最简单的分类器(nearest neighbor )
- qsort排序文件名
- Who's Aunt Zhang(hdu4633,polay定理)
- CRM上线之路 走上了CRM实施顾问-第16天上班 -第四周
- HDU 1879 继续畅通工程 最小生成树之处理已建的边
- Json转换利器Gson之实例一-简单对象转化和带泛型的List转化
- Unity 3D Physics – Rigidbody 刚体