General doubts in cpp

What is the difference between hash-maps Vs( ordered maps and unorder maps )??Which approach is better??both are used for storing the frequency.

in c++ we have 2 inbuilt hashmaps

  1. map (ordered map)
  2. unordered_map

map is an ordered sequence of unique keys whereas in unordered_map key can be stored in any order, so unordered.

Map is implemented as balanced tree structure that is why it is possible to maintain an order between the elements (by specific tree traversal). Time complexity of map operations is O(Log n) while for unordered_map, it is O(1) on average.