java hashmap time complexity

Solutions on MaxInterview for java hashmap time complexity by the best coders in the world

showing results for - "java hashmap time complexity"
Giuseppe
10 Mar 2018
1On the other hand, a HashMap has an average time complexity of O(1) 
2  for put() , contains() and remove() operations. 
3  The worst-case time complexity for those operations is O(log n) 
4  since Java 8, and O(n) before that. Space-complexity wise, both
5  have a complexity of O(n)
Caterina
21 Oct 2019
1On the other hand, a HashMap has an average time complexity of O(1) for put() , contains() and remove() operations. The worst-case time complexity for those operations is O(log n) since Java 8, and O(n) before that. Space-complexity wise, both have a complexity of O(n)