Recall & Review
beginner
What is a hash table?
A hash table is a data structure that stores data in key-value pairs. It uses a hash function to convert keys into an index where the value is stored, allowing fast data retrieval.
Click to reveal answer
beginner
How do hash tables help in implementing a dictionary?
Hash tables allow quick lookup, insertion, and deletion of words and their meanings by using the word as a key and the meaning as the value, making dictionary operations very efficient.
Click to reveal answer
intermediate
Why are hash tables useful for caching?
Hash tables store cached data with keys representing requests or queries. This allows quick access to previously computed results, improving performance by avoiding repeated calculations.
Click to reveal answer
beginner
Explain how hash tables are used in counting frequencies.
Hash tables can count how often items appear by using the item as a key and increasing the value each time the item is found. This is useful in tasks like counting word occurrences in text.
Click to reveal answer
intermediate
What is a common challenge when using hash tables and how is it handled?
A common challenge is collisions, where two keys hash to the same index. This is handled by methods like chaining (storing multiple items in a list at one index) or open addressing (finding another empty slot).
Click to reveal answer
What does a hash function do in a hash table?
✗ Incorrect
A hash function converts a key into an index where the value is stored in the hash table.
Which of these is NOT a typical use of hash tables?
✗ Incorrect
Hash tables do not store data in sorted order; they focus on fast access using keys.
How do hash tables handle collisions?
✗ Incorrect
Collisions are handled by chaining (storing multiple items at one index) or open addressing (finding another slot).
In a dictionary application, what is typically used as the key in a hash table?
✗ Incorrect
The word is used as the key to quickly find its meaning stored as the value.
Why are hash tables preferred for caching?
✗ Incorrect
Hash tables allow fast access to cached data, improving performance by avoiding repeated work.
Describe three common applications of hash tables in everyday computing.
Think about how hash tables help with quick access and organizing data.
You got /3 concepts.
Explain what a collision is in a hash table and how it can be resolved.
Consider what happens when two items want to use the same spot.
You got /3 concepts.