After completing your binary search tree class run the following experiments on the class and record the results. Create an empty binary search tree class and insert 1000 randomly generated Integer objects. Here is one way of doing this: int n = 1000; Random r = new Random(); BinarySearchTree b = new BinarySearchTree(); for(int i = 0; i < n; i++){ b.add( r.nextInt() ); } Record the time it takes to do this using the Stopwatch class. Record the height of the tree after inserting the 1000 items. Record the size of the tree. (It may not be 1000 because the random number generator may produce duplicates.). For each value of N what is the minimum possible tree height, assuming N unique values are inserted into the tree? Run this experiment 10 times and note the average time to do the insertions, average height of the tree, and average size of the tree. Repeat the experiment 10 times for the following values of N: 2,000, 4,000, 8,000, 16,000, 32,000, 64,000, 128,00, 256,000, 512,000, and 1,024,000. Record all information. (You should, of course, automate these experiments to save time.) Based on the data what do you think the Big O is to add N random integers to one of your BST objects? Repeat the experiment using random integers, but use the java TreeSet class. This class is in the java.util package. The documentation for the class is at http://java.sun.com/j2se/1.5.0/docs/api/java/util/TreeSet.html For each experiment with TreeSet you just need to note the average time it takes to add the items. (The TreeSet class does not provide a way to get the height of the tree.) Based on the data what do you think the Big O is to add N random integers to a Java TreeSet object? --------------------------------------------------------------------- Next, Generate a list of 1000 integers sorted in ascending order. For example: 1, 2, 3, 4, ... 1000 Create an empty binary search tree class and insert the 1000 sorted integers into it. What will the height of the tree be? Try to determine this with your \ height method and by thinking about what the resulting height should be based on your insertion algorithm. Run this experiment 10 times and note the average time to do the insertions, If you implemented the add method recursively as shown in class you may get a stack overflow error when trying to add a few thousand elements that are already sorted. This is because the tree is becoming a linked list and the thousands of activation records are using up all the stack space. To complete this experiment complete and use the method iterativeAdd instead of your recursive add. (Implement the add method iteratively instead of recursively.) Repeat the experiment 10 times for the following values of N: 2,000, 4,000, 8,000, 16,000, 32,000, and 64,000. Predict how long it would take to add 128,000, 256,000, and 512,000 sorted integers into your binary search tree. Repeat the experiment using integers in sorted order, but use the java TreeSet class. This class is in the java.util package. The documentation for the class is at http://java.sun.com/j2se/1.5.0/docs/api/java/util/TreeSet.html For each experiment with TreeSet you just need to note the average time it takes to add the items. (The TreeSet class does not provide a way to get the height of the tree.) How do these times compare to the times it took for you BinarySearchTree class when inserting integers in sorted order? What do you think is the cause for these differences? How do these times compare to the times it took for your BinarySearchTree class when inserting randomly distributed integers?