Red-Black Trees
Red-Black trees are self balancing binary search trees
Properties
- Each node is either red or black
- The root node is black
- No red nodes have red children
- All paths from the root to a null child have the same number of black nodes
Insertion
- Use the BST insertion algorithm to insert new node as a red node
- If there's a property violation, fix the tree using one of the cases depicted below
- Validate the tree is valid if required by fix