What information entered the process?
Labs / Computer Science
Hash Table
Every key is run through a hash function that picks a bucket, then dropped in. When two keys pick the same bucket they collide and hang off the same chain. Insert keys, resize the table, or swap in a worse hash function and watch the chains grow.
Labs / Computer Science / Hash Table
Hash Table
Every key is run through a hash function that picks a bucket, then dropped in. When two keys pick the same bucket they collide and hang off the same chain. Insert keys, resize the table, or swap in a worse hash function and watch the chains grow.
Why it matters
Why explore this?
Computer science turns clear rules into reliable processes. This model lets you step through those rules and see how each decision changes the result.
Explore
Try the model
Investigate
Questions to test
Predict first, try it in the model, then use what you observe to answer.
What to try
- As the load factor α climbs past 1.0, what happens to the length of the longest chain?
- Switch to the "Worst" hash function. Where do all the keys go, and why is that the slowest possible table?
- Fill the table, then press Rehash ×2. Why do the chains suddenly get shorter even though no keys were removed?
- With a fixed number of keys, does doubling the buckets ever reduce collisions all the way to zero? What would that require?
- Compare "Even spread" and "Poor" at the same load factor — which one keeps lookups fast, and how can you tell from the picture?
Explain
Make sense of what happened
Trace the process one step at a time. Name the rule used at each important step, then explain why the final result follows from those rules.
Check
Before you leave
Which rule changed it?
Why did the process produce this result?
If you can answer all three using evidence from the model, you understand the main idea. If not, return to Explore and change one setting at a time.