What is an HashMap?

An hash map is a data structure that holds un-ordered pairs of

In Java an HashMap:

  • Can hold null values
  • Can hold null keys
  • Un-ordered collection
  • Is not thread-safe

What is an HashMap Time Complexity

AlgorithmAverageWorst case
SpaceO(n)[1]O(n)
SearchO(1)O(n)
InsertO(1)O(n)
DeleteO(1)O(n)