Red-Black tree Rotation, Insertion, Deletion
Red-Black tree Rotation, Insertion, Deletion
Red-Black tree Rotation, Insertion, Deletion
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
The Case of the <strong>Black</strong> Uncle<br />
If our uncle was black, observe that all the nodes around<br />
us have to be black:<br />
Had to be<br />
black given<br />
red child.<br />
B<br />
old red<br />
A<br />
R<br />
black uncle<br />
new<br />
red<br />
X<br />
R<br />
For a RB <strong>tree</strong>, after a red<br />
node was a black root<br />
Left as RB <strong>tree</strong>s by our color change or are nil<br />
Solution - rotate right about B:<br />
A<br />
Changing A to black is necessary<br />
because of the color of X.<br />
X<br />
R<br />
B<br />
Then changing B to red<br />
leaves everybodies<br />
black height the same.<br />
Since the root of the sub<strong>tree</strong> is now black with the<br />
same black-height as before, we have restored the colors<br />
and can stop!