Question: The height of the binary search tree characterizes the runtime of some of the methods of the structure. Recall that the height of a node

The height of the binary search tree characterizes the runtime of some of the methods of the structure. Recall that the height of a node is the length of the longest path from the node to a descendent leaf. The height of a tree is the height of its root.
Consider the BSTree structure from 3
Add a method to BSTree that computes the height of the BSTree object. Note that the height
of an empty tree is 0.
Test that method by inserting array 4,7,3,9,1,2,10,5,6,5,8 and then compute the height of the resulting tree.
Test that method by inserting array 1,2,3,4,5,5,6,7,8,9,10 and then compute the height of the resulting tree.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!