Guided lesson

Hash Maps

Hashing

Hash Maps

Core

Mental model

  • Average lookup is O(1).

Operations

get average O(1)

Cost shape

Average O(1), worst O(n)

Watch out

Assuming iteration order unless guaranteed.

Related algorithms

Two SumPrefix Sum with Hash Map
Guided progression
10% lesson
Step 1 / 2Learner goal
Speech settings Speed 1.0 · Volume 90%

Keyboard: Space play/pause · Arrow keys step · Page Up/Down change sections · R restart