Collision Resolution: Chaining

Introduction

A hash function turns a key into an array index, but no matter how good that function is, two different keys will eventually land on the same index. That event is called a collision, and every usable hash table needs a plan for it. Chaining is the most common plan: instead of storing a single key-value pair in each bucket, each bucket holds a small container — usually a linked list — and every pair that hashes to that index is appended to the chain.

This topic walks through what that means in practice. Insertion means finding the bucket and adding a node to its chain; searching means hashing to the bucket and then walking the chain comparing keys; deletion means unlinking a node from a chain, which is noticeably simpler than deletion under open addressing, where removing an element can break probe sequences. The key performance idea is the load factor (number of stored entries divided by number of buckets): as it rises, average chain length rises with it, and lookup drifts from O(1) toward O(n) in the worst case where every key collides.

As you watch, keep three questions in mind. First, what exactly is stored in the array — values, or pointers to list nodes? Second, why must you still compare keys after reaching the right bucket? Third, how does chaining compare to open addressing on memory overhead, tolerance for high load factors, and ease of deletion? You will implement chaining yourself later in the module, so pay attention to the structure of the code as well as the diagrams.

Video 1: L-6.3: Chaining in Hashing | What is chaining in hashing with examples

Gate Smashers · 6:42 · 847,830 views · 5y ago · captions — Watch on YouTube

About this video

A focused follow-up lecture on chaining specifically, explaining what happens when two keys hash to the same index and how a linked list at that index stores all colliding entries. The description indicates worked examples, so expect keys to be hashed and inserted step by step into chains.

Why this video

This is the core explanatory video for the topic, covering what chaining is and how insertion and lookup proceed through a chain, in a short, example-driven format that pairs directly with the overview lecture.

Video 2: Implement a HashTable | Separate Chaining Collision Resolution Technique | Part 1 | Animation

Dinesh Varyani · 10:01 · 16,271 views · 5y ago · captions — Watch on YouTube

About this video

An animated implementation walkthrough that builds a hash table using separate chaining, showing how the bucket array and node links are constructed in code. As part one of a series, it is likely to focus on the data structure setup and the insertion path before later parts handle other operations.

Why this video

It moves you from diagrams to an actual implementation, which is the bridge you need for coding set, get, and remove with chaining yourself; the animated style makes the pointer manipulation in each chain easy to follow.

Video 3: L-6.2: Collision Resolution Techniques in Hashing | What are the collision resolution techniques?

Gate Smashers · 5:33 · 1,323,306 views · 5y ago · captions — Watch on YouTube

About this video

This lecture introduces collisions in hashing and surveys the main families of resolution techniques, typically contrasting separate chaining with open addressing methods such as linear probing, quadratic probing, and double hashing. It is framed as an overview that places chaining in context rather than drilling into one approach.

Why this video

Watching this first gives you the map before the detail, which is exactly what the trade-offs subtopic requires; Gate Smashers is a widely used exam-prep channel whose treatment of collision resolution is concise and terminology-accurate.

How These Videos Support the Learning Outcomes

Together these videos target the chaining half of MO2: the overview lecture names chaining alongside linear probing, quadratic probing, and double hashing so you can compare memory use, load factor tolerance, and deletion handling, while the dedicated chaining lecture supplies the detail needed to argue those trade-offs. Both reinforce MO1 by showing the hash function in action as the step that produces the index where collisions occur, and the discussion of chain length and load factor supports MO3's focus on when hash table operations diverge from O(1) toward linear behavior. The implementation walkthrough directly prepares you for MO4 by demonstrating how a bucket array of linked nodes is coded and exercised, which you will then reproduce and test in JavaScript.

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.