Red-Black Trees
What is a Red-Black Tree?
A Red-Black Tree is a type of self-balancing binary search tree that uses a color property for each node to ensure operation efficiency.
Key Properties
- Each node is either red or black.
- The root node is always black.
- Red nodes cannot have red children.
- Every path has the same number of black nodes.
Why Use Red-Black Trees?
- O(log n) time complexity
- Automatically balanced
- Can be used to implement Dijkstra's shortest path algorith and Prim's minimum spanning tree alogorithm
Example
Learn More
Click here to learn more about Red-Black Trees