- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Red-Black Trees in Data Structure
In this section we will see what is the Red-Black Tree. The Red-Black Trees are self-balancing binary search tree. There are some conditions for each node. These are like below −
Each node has color. Which is either Red or Black
The root will be always black
There will be no two adjacent Red nodes
Every path from a node (including root) to any of its descendent NULL node has the same number of black nodes.
Example of Red-black tree
Red-Black tree with Null Nodes at leaf
Comparison with AVL Tree
AVL Trees are more balanced than the Red-Black tree. But the major disadvantage is, there will be more rotations during insertion and deletion. For multiple insertion and deletion, Red-Black tree will be helpful.
Advertisements