Download presentation

Presentation is loading. Please wait.

Published byEarl Reek Modified over 2 years ago

1
Red-Black Trees (Bayer, Guibas and Sedgewick) RBT example:

2
Red-Black Trees (Bayer, Guibas and Sedgewick) Black-heights: Black-height of tree = black-height of root (2)

3
RBT Violation Fixes Case 1: Color flip aa d c b d c b Color flip fixes or moves violation towards the root.

4
RBT Violation Fixes a Case 2: Color flip a d c b d c b Color flip fixes or moves violation towards the root.

5
RBT Violation Fixes Case 3: Left Rotation Converted to Case 4 a b d c b d c a Rest of Tree

6
Right Rotation RBT Violation Fixes Case 4: a d d c b c b a Rest of Tree Now re-color Nodes b and c.

7
RBT Violation Fixes Case 4: d c b a RBT violation is removed (see next slide). Rest of Tree Color flip Rest of Tree d c b a

8
RBT Violation Fixes d c b a RBT structure is restored. Rest of Tree Case 4: a d c b Rest of Tree

Similar presentations

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google