Mapping 2-3-4 Trees into Red-Black Trees
Mapping 2-3-4 trees into Red-Black trees
- Since we're implementing 2-3-4 trees using binary trees, all nodes
must be 2-nodes.
- This will inherently make the tree deeper, but the benefits outweigh this
- A 2-node requires one red/black node, a 3-node requires two red/black nodes, and
a 4-node requires 3 red/black nodes.
- Splitting a 4-node (implemented in a Red-Black tree) is trivial:
Splitting a 4-node connected to a 2-node
Orientation #1 (2-3-4 tree):
Orientation #1 (Red-Black tree):
Orientation #2 (2-3-4 tree):
Orientation #2 (Red-Black tree):
Splitting a 4-node connected to a 3-node