Hash tables
1.[2p] Why is a direct-address table unusable for ten thousand records keyed by a nine-digit identifier?
Why is a direct-address table unusable for ten thousand records keyed by a nine-digit identifier?
2.[2p] A sufficiently well designed hash function can avoid collisions entirely when the key universe is larger than the table.
A sufficiently well designed hash function can avoid collisions entirely when the key universe is larger than the table.
3.[3p] About how many random keys go into a table of 1,000,000 slots before a collision is more likely than not? Use .
About how many random keys go into a table of 1,000,000 slots before a collision is more likely than not? Use .
4.[2p] A chained hash table has 500 slots and holds 900 keys. What is its load factor?
A chained hash table has 500 slots and holds 900 keys. What is its load factor?
5.[3p] Under linear probing at load factor 0.75, an unsuccessful search costs about probes. How many is that?
Under linear probing at load factor 0.75, an unsuccessful search costs about probes. How many is that?
6.[3p] Which of these are true of open addressing compared with separate chaining?
Which of these are true of open addressing compared with separate chaining?
Select all that apply
7.[2p] Why must every key be reinserted when a hash table is resized?
Why must every key be reinserted when a hash table is resized?
8.[3p] What does a hash-flooding attack exploit?
What does a hash-flooding attack exploit?
9.[3p] Match each query to whether a hash table can answer it efficiently.
Match each query to whether a hash table can answer it efficiently.
Is this exact key present
What is the smallest key
List all keys in order
Insert a new key
no, every slot must be scanned
no, hashing destroys order
yes, expected constant time
yes, amortised constant time
Show the answer
Is this exact key present: yes, expected constant time What is the smallest key: no, every slot must be scanned List all keys in order: no, hashing destroys order Insert a new key: yes, amortised constant time