Module 10

Hash Tables: Structure and Collision Resolution

This lesson covers the hash table data structure, including its internal array-based design, collision resolution strategies such as chaining and open addressing, and performance analysis. Students will implement a hash table in JavaScript.

Topics

This module covers 7 topics. Open a topic to see its subtopics and the materials made for it.

  1. Topic 1Introduction to Hash Tables5 subtopics · 2 materials
  2. Topic 2Internal Array-Based Design5 subtopics · 2 materials
  3. Topic 3Hash Function Design and Properties6 subtopics · 2 materials
  4. Topic 4Collision Resolution: Chaining6 subtopics · 2 materials
  5. Topic 5Collision Resolution: Open Addressing7 subtopics · 2 materials
  6. Topic 6Performance Analysis of Hash Tables7 subtopics · 2 materials
  7. Topic 7Implementing a Hash Table in JavaScript7 subtopics · 2 materials

Module Content

16 items of 3 types: Topic Detail, Topic Videos, Readings. Your instructor made most of them with CourseBuilder+, a program that uses AI to draft course material; each type says how its items were made.

Topic Detail (7)

A detailed reading for each topic, covering its subtopics in order with explanations and examples — reading only, no videos (for the reading with videos, see Topic Detail with Video). Drafted with AI from the module's topics, subtopics and learning outcomes.

  • Introduces hash tables conceptually — explaining what they are, why they matter, and how they achieve fast storage and retrieval regardless of collection size — serving as a starting-point reading for learners new to the data structure.

  • Explains how a hash table is built on top of a contiguous internal array — covering how buckets are indexed and how the array forms the foundation for O(1) operations — helping learners understand the underlying memory structure before exploring higher-level behavior.

  • Covers the design principles and required properties of hash functions — including how keys of various types are converted to array indices and what makes a hash function high-quality — so learners can evaluate and write effective hash functions for their implementations.

  • Explains the chaining collision-resolution strategy — where colliding keys are stored together at the same bucket using a linked structure — so learners understand how to implement and reason about one of the most common approaches to handling hash collisions.

  • Explains open addressing as a collision-resolution strategy — covering probing techniques such as linear, quadratic, and double hashing that find alternative slots within the array when a collision occurs — so learners can compare it with chaining and understand its trade-offs.

  • Analyzes hash table time complexity — examining average-case and worst-case performance for insertion, deletion, and lookup, the role of load factor, and conditions that degrade efficiency — equipping learners and instructors with the tools to evaluate and tune hash table performance.

  • Walks learners through building a hash table from scratch in JavaScript using chaining or open addressing — demonstrating how insert, lookup, and delete operations are coded — serving as a hands-on coding reference that bridges conceptual understanding and practical implementation.

Topic Videos (8)

Videos for each topic: a short introduction to the topic, then up to three YouTube videos embedded, each with what it covers and why it is worth watching. The videos were found by an AI search of YouTube (well viewed, with captions where possible), and the page was written with AI.

  • An introductory reading that defines a hash table as a key-value store with average constant-time insert, lookup, and remove, explaining how a hash function converts a key into an array index; learners use it to build the vocabulary and mental model needed for the rest of the module.

  • A lesson showing how a hash table is layered on top of an ordinary array, with the hash function mapping keys to slot indices and the array providing constant-time access; learners use it to understand the internal design that makes collisions and resizing meaningful.

  • A reading on hash function design that examines the key properties a good hash function must have — deterministic output, uniform distribution, and efficient computation — and how those properties underpin near constant-time operations; learners use it to evaluate or write their own hash functions.

  • A topic explaining chaining as a collision resolution strategy, where each bucket holds a small container (such as a linked list) of all key-value pairs that hash to the same index; learners use it to trace insertion, search, and deletion when multiple keys collide.

  • A topic covering open addressing, in which all elements are stored directly in the table array and collisions trigger a probe sequence to find the next empty slot; learners use it to compare probing rules against chaining and understand clustering and deletion issues.

  • An analysis lesson that unpacks the conditions behind the O(1) average-case claim — even key distribution, controlled load factor, and non-degenerate collision handling — and what happens in the worst case; learners use it to reason about hash table performance and resizing decisions.

  • A hands-on coding topic walking through building a HashTable class in JavaScript with an array of buckets, a hash function, and a collision resolution strategy; learners use it to implement and test insert, get, and remove operations themselves.

  • A consolidated module overview that strings together all topics — introduction, array-based internals, hash function design, chaining, open addressing, performance analysis, and the JavaScript implementation — for use as a single continuous reading or review reference.

Readings (1)

Reading for this module: drafted with AI from the module's topics, or brought in from the course's own files.

  • Walks learners through building a hash table from scratch in JavaScript using chaining or open addressing — demonstrating how insert, lookup, and delete operations are coded — serving as a hands-on coding reference that bridges conceptual understanding and practical implementation.