DSA Lab

Hash table

A hash table turns a key straight into a position with a hash function (here key mod table size), so finding a key means looking in one place instead of searching.

Hash table: how it works

In this tool: chaining and linear probing. Put in your own values and watch it change. Each operation runs one step at a time and says in plain words what happened, with its calculation worked out. The code is shown in Python, C, C++ or Java with the line that just ran marked, and an Understand it panel gives the idea, why it works, the cost of each operation, common mistakes and a short quiz.

Lessons that use it

  • Hash tables (Data Structures)A hash function picks a bucket: collisions handled by chaining and by linear probing, and why the table must not get too full.