#1 India's Top IT Training Institute

×

About Uncodemy

Know more about who we are and what we stand for.

About Us

About Us

Discover our mission to equip individuals with essential IT skills and industry expertise.

Read More →
UnCodeMy Gallery

UnCodeMy Gallery

Explore highlights from our IT training sessions and success stories.

Read More →
×

Free Resources

Learn, practice and plan your career — bilkul free.

Tutorials

Tutorials

Step-by-step written tutorials to learn any technology at your own pace.

Read More →
Free Counselling

Free Counselling

Book a free video counselling session and pick the right course for you.

Read More →
Online Compiler

Online Compiler

Write, run and test your code online — no setup required.

Read More →
⚡ FREE · 4 COLLISION METHODS

Hash Table Visualizer: See Collisions and Probing in Action

Pick a table size and collision method, then watch each key find its slot.

  • 🔁 Linear and quadratic probing
  • 🎯 Double hashing
  • 🔗 Separate chaining

How to use the Hash Table Visualizer

  1. 1. Enter keysNumbers, or words (their character codes are summed).
  2. 2. Choose size and methodA table size from 2 to 50 and how to handle collisions.
  3. 3. Step throughSee the hash, every slot probed and where each key lands.

Hashing and collisions

A hash table stores each key at the slot given by a hash function, here h(k) = k mod m for a table of size m. Lookups then take O(1) on average. When two keys hash to the same slot, that's a collision, handled in one of two ways:

  • Separate chaining: each slot holds a list, and colliding keys join the list.
  • Open addressing: look for another free slot. Linear probing tries h, h+1, h+2 …; quadratic probing tries h, h+1², h+2² …; double hashing steps by a second hash, h₂(k) = R − (k mod R), where R is the largest prime below m.

The load factor (keys ÷ slots) drives performance. Linear probing forms clusters as it fills up, quadratic probing spreads keys out, and double hashing spreads them the most. Above a load factor of about 0.7, open addressing slows down fast.

Worked example

Insert 23, 43, 13, 27, 38, 8 into a table of size 10 with linear probing:

  • 23 → 3. Then 43 → 3 is taken, so it goes to 4. Then 13 → 3, 4 taken, so 5.
  • 27 → 7, 38 → 8, and 8 → 8 is taken, so it goes to 9.

That's 3 collisions and 10 probes for 6 keys, with a load factor of 0.60. Notice the cluster forming at slots 3, 4 and 5. Switch to quadratic probing and 13 jumps from 3 to 4 to 7, which breaks up the cluster. With separate chaining, slot 3 simply holds the list 23 → 43 → 13.

Try a table size of 7 or 11 (a prime): keys spread more evenly than with 10, which is why hash table sizes are often chosen to be prime.

Frequently asked questions

How are words hashed?

By adding up their character codes and taking the result mod m. Real hash tables use better functions, but this keeps the arithmetic easy to check.

Why might quadratic probing fail to find a slot?

It only visits some slots. With a prime size and a table under half full, it is guaranteed to find one.

What does Python's dict use?

Open addressing with a perturbed probe sequence, and it resizes before the table gets too full.

Is the hash table visualizer free to use?

Yes, the hash table visualizer is free and costs nothing. Inserting your first keys shows a short form for your name and WhatsApp number one time; once that's done, this tool and every other Uncodemy tool open with no form.

More free tools

See all free tools