notes58

notes58 - CS251 Notes: Week 7 March 20th, 22nd, 24th...

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

View Full Document Right Arrow Icon
CS251 Notes: Week 7 March 20th, 22nd, 24th Red-Black trees Deletion General cases Red-Black tree deletion is similar to AVL tree deletion. There are two general cases: 1. Node has no external children Removing the red node requires no complicated operations. 2. Node has external children Locate the in-order predecessor (right most node in left subtree). Double black edge When a red edge is deleted the parent black edge is unaffected. However, when a black edge is deleted, a "double black" edge appears. The "double black" is needed to maintain black height across the tree. The tree must be restructured to remove the double black. Case 1: Sibling has a red edge 1. Find X, Y, Z and a, b, c Removing 10 causes a double black edge. Z is the parent of the double black. Y is the sibling of the double black. X is the edge connected to a red edge. Label a, b, c in ascending order. 2. Perform restructure.
Background image of page 1

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

View Full DocumentRight Arrow Icon
b is always the parent, a the left child, and c the right child. Case 2: Sibling has a only black edges
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 5

notes58 - CS251 Notes: Week 7 March 20th, 22nd, 24th...

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

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