The only code you should write the following:
Code is available at
https://cs.brynmawr.edu/cs151/Data/Lab10/LinkedBinaryTree.java https://cs.brynmawr.edu/cs151/Data/Lab10/TreeInterface.javaor via scp at
/home/gtowell/Public/151/Data/Lab10/LinkedBinaryTree.java /home/gtowell/Public/151/Data/Lab10/TreeInterface.javaFor example: if this is the code in my main method:
public static void main(String[] args) { LinkedBinaryTreethen this is the output of my programts = new LinkedBinaryTree<>(); ts.insert(0); System.out.println(ts.toString()); ts.insert(2); System.out.println(ts.toString()); ts.insert(4); System.out.println(ts.toString()); ts.insert(-1); System.out.println(ts.toString()); ts.insert(-2); System.out.println(ts.toString()); ts.insert(-3); System.out.println(ts.toString()); }
<0: 0 avl:1> <0: 0 avl:2> <1: 2 avl:1> Out of balance in subtree rooted at 0 avl:3 Right side to deep <0: 0 avl:3> <1: 2 avl:2> <2: 4 avl:1> <1: -1 avl:1> <0: 0 avl:3> <1: 2 avl:2> <2: 4 avl:1> <2: -2 avl:1> <1: -1 avl:2> <0: 0 avl:3> <1: 2 avl:2> <2: 4 avl:1> Out of balance in subtree rooted at -1 avl:3 Left side to deep <3: -3 avl:1> <2: -2 avl:2> <1: -1 avl:3> <0: 0 avl:4> <1: 2 avl:2> <2: 4 avl:1>