Explanation
- **Cuckoo Hashing** is a hash table algorithm that resolves collisions using two hash functions. If an item collides at one position, it is "kicked out" and reinserted into another position using a second hash function.
-
-
Steps
- Insert an element using the first hash function.
- If the spot is occupied, evict the existing element and insert it using the second hash function.
- Repeat until the element is inserted without further eviction.
-
Time Complexity
- Time complexity: O(1) average for insertion and look-up.