CSC 232 - Introduction to Computer Science II
Lab 8
Download the files BinaryTree.java and BTInputFile.txt and modify the
BinaryTree class as follows:
- Add a main method. Read the binary tree stored in the file
BTInputFile.dat and display it on the computer's screen. Then, test the
isLeaf() and getRightSubtree() methods of the BinaryTree class. Note that
all of this code will be done in the main method.
- A recursive definition of the height of a binary tree T is as follows:
if T is empty its height is 0; otherwise, its height is 1 + the maximum
height of its subtrees. Write a method height() that returns the height of a
binary tree. Make sure to test this method in the main method.
Print out a hard copy containing only the new methods you added for this lab.
Make sure to also show the instructor your program running and to upload an
electronic copy in your CSC232 upload folder in a folder called LABS\lab8.