This project compares the performance of 2 binary search trees as more objects are added to them. Initially, one tree is balanced and one is not. Modify the Add method so that it returns the number of comparisons used. Then create 2 empty binary search trees. Associate 2 variables with each tree. One variable sums the number of comparisons used in adding values to a tree, and the other sums the heights of a tree at certain times following the insertion of several values. In a loop that executes 100 times do the following:
Add the values 1000,2000,3000,4000,5000,6000,7000,8000 to both trees. In the first tree, add them in increasing order. In the second, add them in order that forms a complete tree. Your first tree will be unbalanced, while the second tree is balanced.
Generate 10 random values between 0 and 9000. Add these values to each tree in the same order. After each of these additions, update each trees comparisonSum variable by the number of comparisons performed for the insertion.
Add each trees height to is heightSum variable
Clear the two trees.