Hash Table Simulator is an interactive, front-end educational simulator for learning how hash tables work. It visualizes insertion, searching, and deletion across three collision-resolution strategies:
- Separate Chaining
- Linear Probing
- Double Hashing
The app shows each probe step in real time, highlights active cells, and logs every action so users can follow the exact execution path.
- Students learning data structures and collision handling
- Instructors who need a visual classroom demo
- Self-learners comparing hashing strategies side by side
- Interactive hash table size control (3 to 50)
- Step-by-step visual playback for each operation
- Runtime log panel explaining every probe and decision
- Support for tombstones (lazy deletion) in open addressing
- Built-in educational note cards covering core hashing concepts
- Table cells store chains (lists) of keys
- Collisions append to the same chain
- Search and delete traverse the chain
- Open addressing strategy
- Collision path follows:
$(h_1 + i) \mod m$ - Uses tombstones for safe deletion
- Open addressing with a second hash step size
- Probe path follows:
$(h_1 + i \cdot h_2) \mod m$ - Helps reduce primary clustering vs linear probing
- Node.js 18+ (recommended)
- npm
npm installnpm run devDefault dev URL:
npm run buildnpm run preview- Choose an algorithm from the header tabs.
- Set table size using the slider.
- Enter a non-negative integer key.
- Click one of:
- Insert Key
- Search
- Delete
- Watch the visualization and runtime logs update step by step.
- Use Reset Environment to clear the table and logs.
Tips:
- Press Enter in the input box to run Insert quickly.
- During an active playback, controls are locked to keep execution consistent.
- Only non-negative integers are accepted.
- Duplicate inserts are rejected.
- Open addressing deletion uses tombstones (DEL markers), not hard removal.
- Insert fails when the table is full and no reusable slot exists.
The left panel includes a multi-section theory reference with topics such as:
- Hashing basics
- Collision handling
- Separate chaining
- Open addressing
- Linear probing clustering
- Double hashing
- Applications of hashing
Use the card list to open any topic, then navigate with Previous/Next controls.
npm run dev- start Vite dev server on port 3000npm run build- create production buildnpm run preview- preview the production build locallynpm run lint- run TypeScript type-check (no emit)npm run clean- remove dist folder
- React 19 + TypeScript
- Vite 6
- Tailwind CSS 4
- Motion (animation)
- Lucide React (icons)
src/
App.tsx # Main layout, controls, playback loop
components/
HashVisualizer.tsx # Table and probe visualization
EducationalSection.tsx # Theory cards and modal notes
lib/
simulator.ts # Hashing and operation simulation logic
types.ts # Shared TypeScript types
- App does not start:
- Confirm Node.js is installed and up to date.
- Delete
node_modulesand runnpm installagain.
- Port 3000 is busy:
- Stop the process using port 3000, or temporarily change the dev port in
package.json.
- Stop the process using port 3000, or temporarily change the dev port in
- Type errors in editor:
- Run
npm run lintto view TypeScript issues.
- Run
This project is licensed under the Educational Use Only License (EUOL) v1.0. See the LICENSE file for full terms.