Question: 1 . Add two methods getSmallest and getLargest to LinkedBST. getSmallest should return the smallest element in the tree and getLargest should return the largest

1. Add two methods getSmallest and getLargest to
LinkedBST. getSmallest should return the smallest
element in the tree and getLargest should return the
largest element in the tree.
Note: To improve efficiency, both methods should check the
least amount of Nodes required to arrive at the answer. In
other words, you should not traverse the entire tree to find
the smallest and largest elements.
2. Add a height method to BinaryNode which returns its
height. You can calculate this recursively by the following
recursive equation:
The height of a Node is 1+ the height of its tallest subtree.
The height of None is 0
After BinaryNode has a height method, add a height
method to LinkedBST which returns the height of the
entire tree (i.e. simply call height on the root Node and
return its return value)
1 . Add two methods getSmallest and getLargest to

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!