AlgoViz

Hash usage

easy 16 min

Hash maps and hash sets find a key by computing where it lives instead of searching for it, so insert, lookup and delete cost O(1) on average.

Six hash patterns in one file

Read it, run it, change a line and run it again.

Loading editor…

Every function is one pass with O(1) average dict or set operations, so each runs in O(n) time with O(n) extra space at most.