Introduction to Hash Tables

Introduction

A hash table is a data structure that stores key-value pairs and, in the average case, lets you insert, look up, and remove an entry in constant time. Instead of scanning a list to find a key, a hash table runs the key through a hash function that produces a number, and that number is converted into an index in an underlying array. The array does the actual storing; the hash function is what tells you where to look.

This topic matters because hash tables sit underneath many of the tools you already use — dictionaries, maps, sets, caches, symbol tables, database indexes — and because the rest of this module builds directly on it. Before you can reason about collisions, load factors, or chaining versus open addressing, you need a clear mental picture of the key-to-index mapping and of the array that the mapping points into.

While watching these videos, focus on three things. First, what exactly the hash function takes in and what it produces. Second, how that output becomes a valid array index (watch for the modulo step). Third, the moment where two different keys land on the same index — that is a collision, and noticing where it comes from now will make the collision-resolution material later in the module much easier.

Video 1: L-6.1: What is hashing with example | Hashing in data structure

Gate Smashers · 5:53 · 2,565,032 views · 5y ago · captions — Watch on YouTube

About this video

A short lecture that defines hashing in the context of data structures and walks through an example of mapping keys into a table. Based on the title and description, it should cover what a hash function is, why hashing is used instead of searching linearly, and how a simple hash function such as modulo division places keys into slots.

Why this video

Gate Smashers is a widely followed exam-prep channel known for compact, example-driven explanations, and this video's focus on the concept of hashing with a worked example matches the subtopics on hashing and the role of the underlying array.

Video 2: Hash tables in 4 minutes

Michael Sambol · 3:52 · 389,765 views · 4y ago · captions — Watch on YouTube

About this video

A four-minute overview of hash tables as a data structure, with accompanying Python code linked in the description. It is likely to cover the key-value store idea, how a hash function maps a key to a bucket, and the basic operations, with a brief look at what happens when keys collide.

Why this video

Michael Sambol's algorithm videos are known for being tightly edited and technically accurate, making this an efficient first or second pass that reinforces the key-value purpose and the array-backed structure.

Video 3: Introduction to Hashing | Data Structures and Algorithms

Dinesh Varyani · 14:22 · 24,350 views · 5y ago · captions — Watch on YouTube

About this video

A longer, slide-based introduction to hashing within a full data structures and algorithms course. The extra runtime suggests a more gradual treatment: what problem hashing solves, how keys are converted to indices, and how the hash table relates to the array it is built on.

Why this video

This is the most detailed of the three and is useful if the shorter videos move too quickly; as part of a structured DSA series, it places hashing in the broader context of data structures covered in this course.

How These Videos Support the Learning Outcomes

These videos establish the foundation that MO1 depends on: each one shows a hash function taking a key and producing an array index, which is the mapping you will later analyze in terms of determinism, uniform distribution, and speed. By making the underlying array and its fixed number of slots explicit, they also set up the collision scenario central to MO2 and the load-factor reasoning behind MO3, since collisions are what push performance away from O(1). Finally, the conceptual model of set, get, and remove on a key-value store — reinforced by the code sample linked from the Sambol video — gives you the design target you will implement in JavaScript for MO4.

About These Videos

These videos were chosen from YouTube on October 2, 2026. Each has captions; the player turns them on. Videos on YouTube can be changed or removed — if one no longer plays, tell your instructor. If a player does not appear, use its Watch on YouTube link.