Hash tables
A hash table turns a key into an array index with a hash function, so a lookup goes straight to one bucket instead of searching, which is why `x in s` for a set is $O(1)$ on average and for a list $O(n)$.
A hash table turns a key into an array index with a hash function, so a lookup goes straight to one bucket instead of searching, which is why `x in s` for a set is $O(1)$ on average and for a list $O(n)$.