Project: Traditional Red-Black Trees

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 and implement the rotations that maintain the properties of traditional red-black trees. This project appears in the book as Project 4.8 on page 267.

2. Traditional red-black trees

Finish the method TradRBBalancer.putFixup(). Test using TRBBSTMTest. This test case has two exceptions that it throws: DoubleRedException indicating two red nodes occurring in a row and InconsistentBlackHeightException indicating a node whose children have different black heights.

Project 4.8 also mentions implementing removeFixup(), but this is unassigned since we are not covering removal from red-black trees.

3. Turn in

Copy the files you modified (BSTMap.java and TradRBBalancer.java) to your turn-in folder /cslab/class/cs345/(your id)/trad-rb .

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


Thomas VanDrunen
Last modified: Thu Apr 11 11:29:17 CDT 2019