Assignment 1

Due Feb 3, 2005

Produce code with the following functionality:

1. Implements a binary search tree with addition. You don’t have to implement delete on the tree.

1. The nodes in the tree contain integers.

1. Print out the elements in the tree from the smallest to largest.

1. Print out the elements in the tree that have a digital sum of 6. The digital sum of an integer is computed by adding all the digits of the integer repeatedly until one is left with one digit. So for example, to compute the digital sum of 5972 we add all its digits (5+9+7+2) to get 23. Since this number has two digits we add them 2+3 to get 5. Since this is one digit, it is the digital sum of 5972.

You are to write your own binary search tree code. Do not use any existing binary search tree library. You can use non-BST code from your language’s api. The binary search tree is to be pointer based, not embedded in an array (or vector).

 Item Percent of Grade Working Code 30% Unit Tests 20% Comments 20% Quality of Code 30%

Working Code. How well your code meets the functional requirements listed above accounts for 30% of the grade for the assignment.

Unit Tests. Having unit tests that cover the functionality of your code accounts for 20% of your grade. The unit tests are to be scalable. Tests using just print statements are not scalable.

See http://www.eli.sdsu.edu/courses/fall03/cs535/notes/testing/testing.html for notes on unit testing (SUnit) Smalltalk. See http://www.eli.sdsu.edu/courses/fall02/cs580/notes/testing/testing.html for notes on unit testing (JUnit) in Java. See http://www.junit.org/ for more information about JUnit.

For C++ and C# you can get the equivalent testing framework at http://www.xprogramming.com/software.htm