Objectives and Overview: Binary search trees can provide an efficient vehicle for searching, provided that they are well-balanced. However, as you know, the guarantee of balance in a binary search tree is not automatic; worst-case search of an n-element binary search tree is O(n) in complexity.
The so-called "AA tree" can be used to ensure that a binary search tree remains balanced as new nodes are inserted. This lab provides an opportunity for you to exercise the AA-tree. You should be familiar with the relevant sections of Chapter 16 in your text before doing this lab.
On the CS210 (Tucker) server is a driver program called XRef2.cpp, a revised version of the cross-reference generator that uses AA trees. Drag this to the desktop, along with a fresh copy of the programs given in the following display to make a project called Lab8.µ.
Now run this program so that it will build an AA tree from the file tictactoe.cpp.
The erroneous height given in the output comes from a faulty Depth function. That is, the Depth of a node in the tree is not simply the difference between that node's level and the root's level. This is only true if the node is not a right-horizontal child of its ancestor (that is, is not a "red" node, in the vernacular of a red-black tree). If the node is a right-horizontal child, then its depth is one greater than that of its parent, even though it has the same level as its parent.
Submit your team's modified C++ file AATreeteamname.h from Part 2 of this lab by dragging it to the Drop Box folder. Also hand in a hard copy listing of this file, along with your answers to the remaining questions in Part 1 and your team's answers to the questions in Part 2.
Part 2 of this lab must be done as a team, according to the team assignments given below. This team selection will be continued into the final project, where the need for a division of work will be more compelling.