DSA Lesson 13 of 33

Hash Tables

Understand key-value storage and fast lookup.

Course Progress39%

Theory

A hash table stores data using key-value pairs. A hashing function is used to determine where a value should be stored. Hash tables provide very fast average-case lookup, insertion and deletion.

Example

const users = new Map(); users.set("name", "Prachi"); users.set("role", "Developer"); console.log(users.get("name"));

Expected Output

Prachi

Practice

Create a Map containing student names and their marks.

Interview Questions

  1. What is a hash table?
  2. What is hashing?
  3. What is a key-value pair?
  4. Why are hash tables useful?