Java Reference
In-Depth Information
8. The HashMap and TreeMap classes both implement the Map interface.
9. To find all keys and values in a map, iterate through the key set and find the
values that correspond to the keys.
10. A hash function computes an integer value from an object.
11. A good hash function minimizes collisionsÈŒidentical hash codes for different
objects.
756
757
12. A hash table can be implemented as an array of bucketsÈŒsequences of nodes
that hold elements with the same hash code.
13. If there are no or only a few collisions, then adding, locating, and removing
hash table elements takes constant or O(1) time.
14. The table size should be a prime number, larger than the expected number of
elements.
15. Define hashCode methods for your own classes by combining the hash codes
for the instance variables.
16. Your hashCode method must be compatible with the equals method.
17. In a hash map, only the keys are hashed.
18. A binary tree consists of nodes, each of which has at most two child nodes.
19. All nodes in a binary search tree fulfill the property that the descendants to the
left have smaller data values than the node data value, and the descendants to
the right have larger data values.
20. When removing a node with only one child from a binary search tree, the child
replaces the node to be removed.
21. When removing a node with two children from a binary search tree, replace it
with the smallest node of the right subtree.
22. If a binary search tree is balanced, then adding an element takes O(log(n)) time.
Search WWH ::




Custom Search