public class BST{ // this Binary Search Tree is used for the implementation of the // Symbol Table containing IdVals: (id,value) pairs // An IdVal is a Comparable containing a String Identifier Key // and a Boolean Value private BSTNode root; //empty tree public BST(){ this.root = null; } public boolean isEmpty(){ return root==null; } public void insertItem(IdVal item) throws BSTException{ root = insertItem(root, item); } public IdVal retrieveItem(String key){ return retrieveItem(root,key); } public void preorderTraverse(){ if (!isEmpty()) preorderTraverse(root,""); else System.out.println("root is null"); } public void preorderTraverse(BSTNode node, String indent){ System.out.println(indent+node.getItem()); if(node.getLeft()!=null) { System.out.println(indent+"left"); preorderTraverse(node.getLeft(),indent+" "); } if(node.getRight()!=null) { System.out.println(indent+"right"); preorderTraverse(node.getRight(),indent+" "); } } }