Amazon Interview Question
Either go Open addressing or Separate chaining.
Open Add: Linear, Quadratic probing or double hashing.
Linear/Quadratic with the same clustering problem in near future.
Double hashing, proffered over Linear/Quadratic.
But if you will see, in the java api, they made use of Separate chaining for implementing maps.
Please correct me, if anything wrong/missing.
Thanks..
whenever a collision occurs, create a linked list with all those elements for that key. then the complexity becomes O(L), where L is the number of elements in the linked list instead of O(1).
- avis1001 April 05, 2007