Interview Question
Country: United States
Use Hashing with open-addressing mechanism. This will definitely work.
Take an array of size M = 100. Make your hash function extremely inefficient so that long clusters are formed and your array becomes full. Now try to insert the next item (which hashes to the same bucket). As the table is full, it will keep searching for an empty entry, but won’t find any and falls in an infinite loop!
Use a circular linked list or queue. You will never find a NULL there.
- punter February 12, 2012