```
Left-Leaning Red-Black Trees
Implementing 2-3 trees via 1-1 correspondence.
Kevin Lin, with thanks to many others.
1
Give the exact height of the corresponding LLRB tree.
2
D E
P
B
G
J
N
Q R
V W
A
C
F
H
I
K
M
O
S U
T
L
Q
?: How are 3-nodes (nodes with 2 keys) represented in the corresponding LLRB tree?
Q1: Give the exact height of the corresponding LLRB tree.
Give the exact height of the corresponding LLRB tree.
3
D E
P
B
G
J
N
Q R
V W
A
C
F
H
I
K
M
O
S U
T
L
A
Maximum Possible Height
4
Q
Given a 2-3 tree of height H, give the exact worst-case height of the corresponding LLRB tree.
Q1: Given a 2-3 tree of height H, give the exact worst-case height of the corresponding LLRB tree.
Maximum Possible Height
5
A
Given a 2-3 tree of height H, give the exact worst-case height of the corresponding LLRB tree.
Single Insertion
6
Q
If we add 15, which operation(s), if any, will we need to perform to maintain LLRB invariants?
rotateLeft(____)
rotateRight(____)
flip(____)
25
17
43
13
22
39
?: Draw the corresponding 2-3 tree. Then, insert 15 in to the 2-3 tree.
Q1: If we add 15, which operation(s), if any, will we need to perform to maintain LLRB invariants?
Single Insertion
7
A
If we add 15, which operation(s), if any, will we need to perform to maintain LLRB invariants?
rotateLeft(____)
rotateRight(____)
flip(____)
25
17
43
13
22
39
Batch Insertion
8
Q
Draw the LLRB that results from inserting these items in the given order: 1, 2, 3, 7, 8, 9, 5.
?: Draw the 2-3 tree that results from inserting these items in the given order: 1, 2, 3, 7, 8, 9 5.
Q1: Draw the LLRB that results from inserting these items in the given order: 1, 2, 3, 7, 8, 9, 5.
Batch Insertion
9
A
Draw the LLRB that results from inserting these items in the given order: 1, 2, 3, 7, 8, 9, 5.
```