and the following method to the BinarySearchTree class:
heightReturns the height of the tree, i.e., the length of the longest path from the root to a leaf. weightReturns the weight of the tree, i.e., the sum of all the node depths.
Be sure to test your methods thoroughly before continuing.
avgCostReturns the average cost of a search in the tree, i.e., weight/size.
Your program should display the average of these heights and costs over all of the constructed trees. For example,
| number of values (N) | ⌈log2(N+1)⌉ | average cost | average height |
|---|---|---|---|
| N = 1,000 | |||
| N = 2,000 | |||
| N = 4,000 | |||
| N = 8,000 |