1. Suppose the keys can be compared using a compareTo method (such as in Programming Project 11 on page 519). Can you think of some advantage to keeping each linked list of the table sorted from...


1. Suppose the keys can be compared using a compareTo method (such as in Programming Project 11 on page 519). Can you think of some advantage to keeping each linked list of the table sorted from smallest key to largest key?


Programming Project 11 page 519


Java has a generic interface called Compara. A class that implements the Comparable interface must have a method with this specification:





Write a generic class for a bag of Compara
 objects, where the objects are stored in a binary search tree. The tree itself should use the BTNode class from Figure 9.10 on page 490.


The first line of your new bag class should be:





This tells the Java compiler that the ComparableTreeBag is a generic class, but that any instantiation of the generic type parameter E must implement the Compara
 interface.












Dec 02, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here