Morgan Stanley Interview Question

How does HashMap works? What is the time complexity of the get method in HashMap?

Interview Answer

Anonymous

Sep 14, 2018

Time complexity of get method is O(1). Hashmap internally uses an array of Entry to store elements. Key & value are stored in this array after performing hashing of key.

2