CSE326 Assignment #3
Spring 2002

Due: Friday, April 26, 2002, at the beginning of class.



Reading in Lewis & Denenberg:


Problems

  1. You've seen code for several different types of tree objects: regular trees, BST's, and (once you've read the AVL assignment) AVL trees. The different trees have been given to you as distinct, unrelated objects. A good object-oriented programmer would have arranged the tree classes into a hierarchy in order to maximize code reuse.

    I want you to come up with a hierarchy for the three classes BinaryTree, BinarySearchTree and AVLTree. Think about issues such as maximizing code reuse and maintaining a consistent interface. Use polymorphism (virtual functions) where appropriate. Ignore everything to do with the Visualizer: concentrate on the core search tree functionality.

    1. Produce a valid C++ .h file for your class hierarchy. You don't need to actually compile it, but you should include all appropriate members and methods of all classes, public, private and protected. Print it out and staple it with the rest of your assignment.

    2. Write a paragraph or two discussing your hierarchy. What is easy to do in your hierarchy? What's hard to do? How does the interface differ from that of the trees for your programming assignments? Don't write more than a page.
From Chapter 4:

From Chapter 6:

From Chapter 7: