Domanda di colloquio di Morgan Stanley

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

Risposta di colloquio

Anonimo

14 set 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