awesome-everything RU
↑ Back to the climb

Algorithms from zero

Hashing: free-recall review

Crux Free-recall prompts across the hashing unit. Answer each in your own words first, then reveal the model answer and compare.
Your altitude — climbing toward senior
ZeroJuniorMiddleSenior
You are at middle altitude — in the sky
◷ 13 min

Retrieval beats re-reading. For each prompt, say or write a full answer from memory before you open the model answer — the effort of recall is what makes hashing stick when you need it in an interview or at 2am.

Goal

Reconstruct the unit’s core mechanisms — what a hash function buys, how collisions are resolved, why the load factor governs cost, why resize is amortized O(1), and the patterns built on top — without looking back at the lessons.

Recall before you leave
  1. 01
    What does a hash function actually buy you, and what is the cost of that O(1) average lookup?
  2. 02
    What is a collision, and how does separate chaining resolve it?
  3. 03
    Define the load factor and explain why it, not the total item count, governs lookup cost.
  4. 04
    Why is hash-table insert O(1) amortized even though a single insert can be O(n)?
  5. 05
    Compare the seen pattern and the complement pattern, and give a problem each solves in one pass.
  6. 06
    When does a hash table fail to deliver O(1), and what do you do about it?
Recap

If you could reconstruct each answer from memory, you hold the unit’s spine: a hash function buys O(1) average access at the price of memory and ordering; collisions are inevitable and chaining stores them in per-bucket lists; the load factor — not raw item count — sets the average chain length and thus the cost; resize keeps it bounded at O(1) amortized; and the seen, complement, frequency, and grouping patterns are all this machinery applied. The guarantee is conditional, and a randomized hash is what defends it against untrusted input.

Continue the climb ↑Hashing: code reading
shortcuts expand
search
K
prev piece
k
next piece
j
cycle tier
t
this menu
?
sources2
expand
  1. 01
  2. 02

Trademarks belong to their respective owners. Editorial reference only.