Binary Tree Lab 1
CPE 103 

This is an individual lab.

Do all the work in the your lab notebook.

1. Write the Java statements to build the tree in Diagram 1 (below) using only the BinaryNode class.

2. Write the Java statements to build the tree in Diagram 1 using the BinaryTree ADT. That is, invoke the methods of the BinaryTree class.

3. Write a very small Java class named TreeLab1 that contains a single method
public static BinaryTree<Character> buildTree()
This method should contain the statements to build the tree in Diagram 2 using the BinaryTree ADT.  After writing the code in your notebook,  construct it on the computer and submit your completed class to Web-CAT for testing. (Note: you won't be able to compile it because you are not provided an implementation of Binary Tree. Web-CAT will compile and test your solution.) You don't need to import BinaryTree.

4. Given a BinaryTree, bt, as shown in Diagram 2 (below), where the last node inserted is node 'J', write the Java statements to print the contents of node 'F'. 

5. In a future project you will be creating your own implementation of BinaryTree. For this lab activity you are to write a series of JUnit test cases that you will use to verify that your BinaryTree implementation is correct.  Each test case is a series of Java statements that will perform some operation on a BinaryTree and make an assertion about the result. You will probably need a dozen or more tests to thoroughly test the ADT. (Test only the public methods, not the private ones.)
When you have a complete set of tests you can try them out on a defective implementation of BinaryTree named DefectiveBinaryTree.