Project #3 (Binary Search Trees)

CMSC 132

Due Date: Friday Oct 13, 6:00 pm

Object-Oriented Programming II

Type of Homework: Closed

Fall 2006


The objective of this project to implement a polymorphic binary search tree.  This project is designed to help you develop your skills at recursion, polymorphism and testing.  This homework is considered a closed homework.  Make sure you read the open/closed policy before continuing working on this project. 


For this project you must implement the methods of the EmptyTree and NonEmptyTree classes.  We have provided a Tree interface and a partial implementation of the SearchTreeMap class (you must implement the keyList and subMap methods).  Complete documentation for this project can be found at javadoc documentation.


Your project will be graded as follows:


It is a required and graded part of your project that you develop and submit test cases that test your code. You only get the one test case in the class PublicTests, and the release tests all have unhelpful names such as testOne and testTwo. The TA's have been instructed that they should not help you debug your code unless you have written a test case on which your code misbehaves.

Using a code coverage tool, such as Clover, is one helpful tool to access whether your tests test all parts of your implementation.

In addition to the release tests, there are additional secret test cases. Don't assume that just because your implementation passes the release tests, it is correct.

Remember you must provide your own tests.


The SearchTreeMap class implements some of the functionality of the Map interface (although not all). A SearchTreeMap object is just a wrapper around a Tree, which is actually used to implement binary search trees.

Note that the insert and delete methods on Tree objects return references to Tree objects. In many cases, these functions may return a reference to the this object. However, in some cases they can't. For example. EmptyTree.getInstance.insert("a", "1") has to return an instance of an NonEmptyTree object.

Design and Implementation Restrictions

There are a number of design restrictions you must obey in your implementation of EmptyTree and NonEmptyTree classes:

IMPORTANT:  In the p3.html file you will find in the code distribution you will see the following restriction:

                You may not add any additional non-private methods or variables.

Ignore that restriction (that was a mistake).  Use this one instead:

         You may add non-private methods.  However, you should not add any non-private variables.

The above restrictions do not apply to your test cases; you may write them however you wish.

Honors Section

Students in the honors section must in addition do the following:


Submit your project using the submit project option associated with Eclipse. 

Academic Integrity

Please make sure you read the academic integrity section of the syllabus so you understand what is permissible in our programming projects.  We want to remind you that we check your project against other students' projects and any case of academic dishonesty will be referred to the University's Office of Judicial Program

Web Accessibility