CS211 DATA STRUCTURES II 2ND COMPUTER SCIENCE & HIGHER DIPLOMA IN INFORMATION TECHNOLOGY LABORATORY 2 Week Beginning 05/02/01 Mr. T Lysaght BINARY SEARCH TREE 1. Download the file BinarySearchTree.java from the course homepage at: http://www.cs.may.ie/~tlysaght/CS211/Cs211Lectures.html and save the file to the same directory as the TreeNode.java, TreeException.java and BinaryTreeBasis.java class files. 2. Create the abstract class KeyedItem which holds an item of type Comparable. All data items to be held in the nodes of the binary search tree will be of type KeyedItem. 3. Compile the BinarySearchTree.java class. 4. Create a class BinarySearchprog.java which extends KeyedItem and which has a main() method to call the BinarySearchTree methods. The main() method in BinarySearchprog will be used to build the binary search tree i.e., it will use the constructor(s) of the BinarySearchTree class and the method insert() to build the tree. 5. Insert the following data in building the binary search tree: Integers: 40, 30, 50, 20 35, 26, 65, 58 6. Write a method printtree() to add to the BinarySearchTree class which prints the items in the tree. The tree should be printed sideways on the screen with the root in the leftmost position. Call printtree() to print the tree. Add the following data to the tree and call the method printtree() again: Integers: 22, 55