Algorithm Analysis (CSC 301 2015F) : Outlines

Outline 12: Red-Black Trees


Held: Wednesday, 23 September 2015

Back to Outline 11 - Binary Search Trees. On to Outline 13 - Red-Black Trees, Continued.

Summary

We start to consider red-black trees, one of the approaches for making balanced trees.

Related Pages

Overview

Administrivia

Upcoming Work

Extra Credit

Academic

Peer

Balancing Binary Search Trees, Continuedj

How do we keep trees balanced? Let's start by thinking about some slightly imbalanced trees. Lowercase letters will represent values, uppercase letters will represent trees. Numbers in parentheses represent the height of a tree

       a(n+3)
        / \
       /   \
    b(n+2) C(n)
     / \
    /   \
 D(n+1) E(n)

How did you balance this?

What are all options you can come up with for adding a leaf that will cause an imbalance?

What whould we do in each case to achieve better balance?

Red-Black Trees

Exercises

These are taken from CLRS.

Insertion