You almost never build a hash map yourself — every language ships a fast one. This lesson is the toolkit: the same operations in all four languages, the one idiom you'll type more than any other (counting), and the traps that catch people in each language.
All of these are O(1) on average, except looping, which visits every entry. For a set, use Set (JavaScript), set() (Python), HashSet (Java) or unordered_set (C++) — the same operations without values.
Free account
Sign up to read the rest of this lesson: 4 more sections, a dry-run simulator and code in JavaScript, Python, Java and C++.
Still to come