RedBlackTrees2

RedBlackTrees2 - Red/Black Trees A 2-3-4 tree 3-node...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
Red/Black Trees A 2-3-4 tree 3-node representation: A B C Red/Black Tree representation: C A A B B C A red/black tree representation of a 3-node can take either form above. One form can be changed into the other by a rotation. If you take the 2-3-4 representation at the top of the page and bring the 10 down, you get the red/black tree form on the left above. If you take the 2-3-4 representation at the top of the page and bring the 20 down, you get the red/black tree form on the right above. This can be a useful way to think about performing rotations: To rotate the red/black tree form on the left above into the one on the right, first bring the 10 up, then bring the 20 down. 10 20 20 10 10 20
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
4-node: 2-3-4 tree representation: A B C D Red/Black tree representation: A B C D 10 20 30 10 20 30
Background image of page 2
Bringing a node up to the parent: 2-3-4 tree representation: A B C D E A B C D E 10 30 20 5 5 20 10 30
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Red/Black tree representation: A B C D E A B C D E Only a color change is required. 5
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 12

RedBlackTrees2 - Red/Black Trees A 2-3-4 tree 3-node...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online