// Allison Obourn // CSE 143 - lecture 21 // Creates a binary search tree of integers. public class IntSearchTreeClient { public static void main(String[] args) { IntTreeNode root = new IntTreeNode(55); root.left = new IntTreeNode(29); root.left.left = new IntTreeNode(-3); root.left.right = new IntTreeNode(42); root.right = new IntTreeNode(87); root.right.right = new IntTreeNode(91); root.right.left = new IntTreeNode(60); IntSearchTree tree = new IntSearchTree(root); // use the jGRASP debugger to see the different traversal orders System.out.print("Preorder: "); tree.printPreorder(); System.out.println(); System.out.print("Inorder: "); tree.printInorder(); System.out.println(); System.out.print("Postorder: "); tree.printPostorder(); System.out.println(); // test the contains method System.out.println(tree.contains(29)); // true System.out.println(tree.contains(55)); // true System.out.println(tree.contains(63)); // false System.out.println(tree.contains(35)); // false IntSearchTree tree2 = new IntSearchTree(); tree2.add(42); tree2.add(5); tree2.add(55); //tree.removeLeaves(); tree.remove(55); tree.remove(16); tree.remove(42); } }