Java Reference
In-Depth Information
A NSWERS TO S ELF -T EST Q UESTIONS
1.
Half of them.
2.
No. Even when
λ
is large, all entries could be in one bucket.
3.
After expanding the table to 11 locations (11 is the prime number larger than twice the current table size of 5), the
function c % 11 places 20 at index 9, 6 at index 6, and 14 at index 3. 18 causes a collision at index 9, so we probe
ahead and place it at index 10.
4.
In each method, replace the statements
index = locate(index, key);
if (index != -1)
with
index = probe(index, key);
if ((hashTable[index] != null ) && (hashTable[index].isIn()))
5.
No. The table size has increased, so rehashing is not necessary.
Search WWH ::




Custom Search