RBtree-Insertion

RBtree-Insertion - violate any of the RB tree rules. Case 2...

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

View Full Document Right Arrow Icon
Insertion in RB tree Assume the following RB tree 8 b/ \r 5 14 b/\b b/ \b 12 18 b/ \b b/ \r 22 b/ \b Valid RB tree Case 1: Insert 3 8 b/ \r 5 14 r/ \b b/ \b 3 12 8 b/ \b b/\b b/ \r 22 b/ \b -attach 3 to the left of 5 using a red edge -always use a red edge when attaching a new node This was the simple case because the inserted node didn’t
Background image of page 1

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

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: violate any of the RB tree rules. Case 2 : Insert 20 2 consecutive red edges. The sibling of the first red edge is black. 8 b/ \r 5 14 r/ \b b/\b 3 12 18 b/\b b/\b b/\r 22 r/ \b 22 b / \b...
View Full Document

Page1 / 2

RBtree-Insertion - violate any of the RB tree rules. Case 2...

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

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