30.12.2013 Views

Red-Black tree Rotation, Insertion, Deletion

Red-Black tree Rotation, Insertion, Deletion

Red-Black tree Rotation, Insertion, Deletion

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.

How can we x two reds in a<br />

row?<br />

It depends upon our uncle's color:<br />

grandparent - MUST be black<br />

<strong>Red</strong><br />

R R<br />

Assume<br />

parent<br />

red uncle..<br />

<strong>Red</strong><br />

new node<br />

R<br />

If our uncle is red, reversing our relatives' color either<br />

solves the problem or pushes it higher!<br />

R<br />

R

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

Saved successfully!

Ooh no, something went wrong!