1Most hash tables are not full.
2Any function can be a hash function if it produces an integer that is suitable to be used as an array index.
3If a class overrides the method equals, it should not override the method hashCode.
4If the method equals considers two objects to be equal, then the method hashCode must return the same value for both objects.
5Calling the method hashCode more than once on an object that has not been altered should return the same value.
6The size of a hash table should always be an even number.
7In open addressing with linear probing, a successful search for an entry that corresponds to a given search key could potentially follow a different probe sequence used to add the entry to the hash table.
9Calculate the hash code for “ACE” with g = 7, given Unicode 'A' = 65, 'C' = 67, 'E' = 69
Answer: 65 * 9 + 67 * 3 + 69 * 1 = 855
10Given a hash table length of 29, what index will the value 371 map to?
Answer: 371 % 29 = 23
11What is λ for a hash table with 500 locations and 200 entries that uses open addressing?
Answer: 200 / 500 = 0.40
12What are the two categories for collision resolution?
[A] Linear Probing [B] Buckets
13Which of the following are 4K+3 prime numbers? a) 6863 b) 857
a) 6863 YES b) 857 NO
14Given the following possible implementations of the hashCode method, which of these would be valid implementations for a class's hashCode method?
- @Override
public int hashCode() {
return 42;
} - @Override
public int hashCode() {
return this.id;
} - @Override
public int hashCode() {
return this.name.hashCode() * 31 + this.age;
} - @Override
public int hashCode() {
return (int) (Math.random() * 1000);
}