// CSE 143, Winter 2010, Marty Stepp // // This client program creates a tree of integers and prints its elements. // You can see a nice visualization of binary trees in jGRASP's debugger. // // Output: // 29 41 6 17 81 9 40 public class TreeMain { public static void main(String[] args) { // construct a tree, manually, node by node (tedious; not standard) IntTreeNode root = new IntTreeNode(17); root.left = new IntTreeNode(41); root.right = new IntTreeNode(9); root.left.left = new IntTreeNode(29); root.left.right = new IntTreeNode(6); root.right.left = new IntTreeNode(81); root.right.right = new IntTreeNode(40); // print the elements of the tree using IntTree class IntTree tree = new IntTree(root); tree.print(); } }