Practice: Left-Leaning Red-Black Trees

For the interest of time, this has been demoted to "practice" instead of "project"---ie, it is optional and not needed to hand in. It is, however, the easiest of the three balanced BST projects, and you may find it useful to complete your understanding of the various approaches to balancing BSTs.

Recall that the description of the AVL tree project contains information about the series of projects that includes this one and the next, as well as the set-up and the code base.

1. Introduction

The goal of this project is to understand the implement the rotations that maintain the properties of left-leaning red-black trees. It appears in the book as Project 4.9 on page 279.

2. Left-leaning red-black trees

Finish the method LLRBBalancer.putFixup(). Test using test.LLRBBSTMTest. In addition to the exceptions for traditional red-black trees, this test also throws RedRightExceptions when it detects red nodes that are right children of their parents.

Project 4.9 also mentions implementing removeFixup(), but we are not covering removal from left-leaning red-black trees.

To keep up with the course, this should be finished by March 27.


Thomas VanDrunen
Last modified: Fri Dec 21 15:22:02 CST 2018