Recall & Review
beginner
What is a hash map?
A hash map is a data structure that stores key-value pairs. It allows you to quickly find a value by using its key.
Click to reveal answer
beginner
What is a hash set?
A hash set is a data structure that stores unique values without any associated keys. It helps to quickly check if a value exists or not.
Click to reveal answer
beginner
How does a hash map differ from a hash set?
A hash map stores pairs of keys and values, while a hash set stores only unique values without pairs.
Click to reveal answer
beginner
Give a real-life example of a hash map.
A phone book where you look up a person's name (key) to find their phone number (value) is like a hash map.
Click to reveal answer
beginner
Give a real-life example of a hash set.
A guest list for a party where each name appears only once is like a hash set, ensuring no duplicates.
Click to reveal answer
What does a hash map store?
✗ Incorrect
A hash map stores key-value pairs, allowing quick access to values using keys.
What is the main purpose of a hash set?
✗ Incorrect
A hash set stores unique values and prevents duplicates.
Which data structure would you use to find a phone number by name?
✗ Incorrect
A hash map stores key-value pairs, perfect for looking up a phone number by name.
Can a hash set store duplicate values?
✗ Incorrect
A hash set does not allow duplicate values; each value is unique.
Which of these is NOT true about hash maps and hash sets?
✗ Incorrect
Hash sets do not store key-value pairs; they store only unique values.
Explain the difference between a hash map and a hash set using a simple real-life example.
Think about how you look up information versus how you check for unique items.
You got /4 concepts.
Describe a situation where using a hash set is better than a hash map.
Consider when you only care if something exists or not.
You got /4 concepts.