Download presentation
Presentation is loading. Please wait.
Published byEarl Reek Modified over 10 years ago
1
Red-Black Trees (Bayer, Guibas and Sedgewick) RBT example: 26 3 38 712 30 15 10 161923 35 39 28 14 21 20 47 41 17
2
Red-Black Trees (Bayer, Guibas and Sedgewick) Black-heights: 26 3 38 712 30 15 10 161923 35 39 28 14 21 20 47 41 17 2 1 1 2 1 1 1 0 0 0 0 00 0 0 00 0 0 0 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
© 2025 SlidePlayer.com. Inc.
All rights reserved.