Java Reference
In-Depth Information
25.
Rewrite the
min
and
max
methods from Self-Check Problem 12 so that they will work on a binary search tree. The
methods should take advantage of the fact that the tree is sorted and should not examine nodes unless necessary.
Section 17.5:
SearchTree<E>
26.
What are some changes that need to be made to the tree class to convert it from storing integers to storing objects
of type
E
?
27.
What kind of changes would you make to add an iterator to our binary tree class?
Exercises
Each of the following exercises is a method to be added to the
IntTree
class from this chapter. You may define addi-
tional private methods to implement your public method if necessary. Several problem descriptions refer to the following
reference binary trees:
Reference Tree #1
3
5
2
1
4
6
Reference Tree #2
2
8
1
0
7
6
4
9
Reference Tree #3
2
3
1
8
7
Search WWH ::
Custom Search