This preview shows pages 1–3. Sign up to view the full content.
1/26
Redblack tree properties
•
Every node in a redblack tree is either black or
red
•
Every null leaf is black
•
No path from a leaf to a root can have two
consecutive red nodes  i.e. the children of a red
node must be black
•
Every path from a node,
x,
to a descendant leaf
contains the same number of black nodes  the
“black height” of node
x
.
In these slides we don’t
force the root to be black
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document2/26
Deletion: The Main Idea
•
We are given a pointer to the node z to be deleted.
•
Since a RedBlack Tree is a Binary Search Tree (BST), use the BST Delete procedure
to:
–
splice out a node y
–
locate x, which is either
•
y’s sole nonsentinel child before y was spliced out, or
•
the sentinel, if y had no children.
•
If y is red, no problem, so stop.
•
If y is black, give x an “extra black.”
–
If x is “redblack,” turn it into a black node and stop.
–
If x is “blackblack ”, use the 4 cases described in the textbook (and there are 4 symmetric
This is the end of the preview. Sign up
to
access the rest of the document.
 Fall '09
 DR.KARENDANIELS

Click to edit the document details