Red-Black Tree
A Red-Black Tree is a self-balancing binary search tree that ensures the tree remains balanced during insertions and deletions. It uses color properties to maintain balance, where each node is either red or black.
- Every node is either red or black.
- The root is always black.
- If a red node has children, then both children are black (no two red nodes can be adjacent).
- Every path from a node to its descendant NIL nodes must have the same number of black nodes.
- Efficient search, insertion, and deletion operations with O(log n) time complexity.
- Maintains balance automatically, ensuring optimal performance.
- Widely used in various applications such as databases and file systems.
RED-BLACK Tree Visualization.
For more information about Red-Black Trees, visit this Wikipedia page.