Recall & Review
beginner Click to reveal answer
What problem does a hash map solve in data storage?
A hash map solves the problem of quickly finding, adding, or removing data by using a key instead of searching through all data items one by one.
beginner Click to reveal answer
How does a hash map find data faster than a list?
It uses a hash function to turn the key into an index, so it can jump directly to the data instead of checking each item one by one.
beginner Click to reveal answer
Why is searching in a list slower compared to a hash map?
Because a list may require checking each item one by one until the target is found, which takes more time as the list grows.
beginner Click to reveal answer
What is the role of a key in a hash map?
The key is a unique identifier used to quickly find the associated value without searching through all data.
intermediate Click to reveal answer
What happens if two keys produce the same hash in a hash map?
This is called a collision, and the hash map uses special methods to handle it so both values can be stored and found correctly.
What is the main advantage of using a hash map over a list?
✗ Incorrect
Hash maps allow fast data lookup by keys, unlike lists which require searching each item.
What does a hash function do in a hash map?
✗ Incorrect
A hash function converts a key into an index to quickly find the data location.
What problem occurs when two keys have the same hash value?
✗ Incorrect
When two keys have the same hash, it is called a collision, which hash maps handle specially.
Why is searching in a list slower than in a hash map?
✗ Incorrect
Lists require checking each item until the target is found, making search slower.
What is stored in a hash map?
✗ Incorrect
Hash maps store pairs of keys and values for quick access.
Explain why hash maps are useful compared to lists for finding data.
Think about how you find a phone number in a phone book versus a list of names.
You got /4 concepts.
Describe what a collision is in a hash map and how it affects data storage.
Imagine two people having the same locker number in a school.
You got /4 concepts.
