Red-Black Trees: Insertion
Below are the details of the different cases that can occur after the insertion of a new node into a red-black tree.
Case 1: Red Aunt
- Rotate (if necessary): Rotate the red parent and child if they are not in alignment.
- Rotate: Rotate the red parent with the subtree's root node.
- Recolor: Change the nodes colors so that the new root node is black and its children are both red.
Case 2: Black Aunt
- Recolor: Change the root node to red and its childre to black.
- Check: Look to see if the recolored root node has cased any double red violations.
Here is further information about Red-Black Trees.