Java Reference
In-Depth Information
java.util.PriorityQueue<E>
remove
java.util.Set<E>
java.util.TreeMap<K, V>
java.util.TreeSet<K, V>
FURTHER READING
1. Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, and Clifford
Stein, Introduction to Algorithms, 2nd edition, MIT Press, 2001.
REVIEW EXERCISES
΢ Exercise R16.1. What is the difference between a set and a map?
΢ Exercise R16.2. What implementations does the Java library provide for
the abstract set type?
΢΢Exercise R16.3. What are the fundamental operations on the abstract set
type? What additional methods does the Set interface provide? (Look up
the interface in the API documentation.)
΢΢Exercise R16.4. The union of two sets A and B is the set of all elements
that are contained in A, B, or both. The intersection is the set of all
elements that are contained in A and B. How can you compute the union
and intersection of two sets, using the four fundamental set operations
described on page 701?
΢΢Exercise R16.5. How can you compute the union and intersection of two
sets, using some of the methods that the java.util.Set interface
provides? (Look up the interface in the API documentation.)
758
759
΢ Exercise R16.6. Can a map have two keys with the same value? Two
values with the same key?
΢ Exercise R16.7. A map can be implemented as a set of (key, value) pairs.
Explain.
΢΢Exercise R16.8. When implementing a map as a hash set of (key, value)
pairs, how is the hash code of a pair computed?
Search WWH ::




Custom Search