Amazon Interview Question

How do you implement a HashMap in java if suppose there was no java.util.HashMap class available.

Interview Answers

Anonymous

May 6, 2012

@NoRiddim, Can you elaborate the two dimensional approach? How do you store the row_index & column_index values?

Anonymous

Sep 5, 2009

write a class which can have two array list.one to store key and another to store value. use some indexing algorithm, to make good performance.

1

Anonymous

Oct 12, 2009

Instead of using 2 lists; which could make synchronizing (when adding/removing) these lists an overhead you could use a 2 dimensional array.