Yahoo Interview Question

implement the hash map and using linked list to solve the conflict

Interview Answer

Anonymous

Oct 20, 2014

With a conflict in a linked list, you traverse the linked list, try to compare all items with the item you are looking for, until you find the right one. A linked list per bucket is one way to do it: if the item is in the list, you are done; otherwise, add a new item at the end of the list. The other is to try the next bucket in the table in a loop, until you find an empty one.