It has been proven that the average search time for an arbitrary item in an arbitrary binary search tree of N items is O(N). For this assignment, you will verify this result experimentally. First, add the member functions whose protoypes are given below to the BinarySearchTree class:
Once you have these member functions implemented and tested, write a program (verify.cpp) which first prompts the user for the number of items to be stored (N) and the number of trees to generate (T). Then, it should repeatedly (T times) store N random numbers in a binary search tree and compute the average cost of searching that tree. Recall that
Your program should print out the average of these costs over all of the constructed trees. In addition, it should print out the average height of the trees. For example,
Note: in order to determine the constant for the average cost and depth, you will need to be able to compute the base-2 logarithm of a number. In the cmath library, there is a function called log10 which computes the base-10 logarithm of a number. Logarithms can easily be converted from one base to another using the formula: loga N = logb N / logb a