18.04.2013 Views

The.Algorithm.Design.Manual.Springer-Verlag.1998

The.Algorithm.Design.Manual.Springer-Verlag.1998

The.Algorithm.Design.Manual.Springer-Verlag.1998

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Lecture 8 - binary trees<br />

Red-black trees have the following properties:<br />

Red-Black Tree Definition<br />

1. Every node is colored either red or black.<br />

2. Every leaf (NIL pointer) is black.<br />

3. If a node is red then both its children are black.<br />

4. Every single path from a node to a decendant leaf contains the same number of black nodes.<br />

Listen To Part 8-16<br />

If the root of a red-black tree is black can we just color it red?<br />

No! For one of its children might be red.<br />

If an arbitrary node is red can we color it black?<br />

What does this mean?<br />

No! Because now all nodes may not have the same black height.<br />

What tree maximizes the number of nodes in a tree of black height h?<br />

Listen To Part 8-17<br />

What does a red-black tree with two real nodes look like?<br />

file:///E|/LEC/LECTUR17/NODE8.HTM (11 of 13) [19/1/2003 1:34:46]

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!