I see unordered map as a convenient O(1) hash map:
> unordered_map is an associated container that stores elements formed by the combination of key-value and a mapped value. The key value is used to uniquely identify the element and the mapped value is the content associated with the key. Both key and value can be of any type predefined or user-defined.
Internally unordered_map is implemented using [Hash Table](https://www.geeksforgeeks.org/hashing-set-1-introduction/), the key provided to map are hashed into indices of a hash table that is why the performance of data structure depends on hash function a lot but on an average, the cost of **search, insert and delete** from the hash table is O(1).
> [!note]- When to use map instead of unordered map
> In the worst case, its time complexity can go from O(1) to O(n2), especially for big prime numbers. You can read more about this on [how-to-use-unordered_map-efficiently-in-c](https://www.geeksforgeeks.org/map-vs-unordered_map-c/). In this situation, it is highly advisable to use a map instead to avoid getting a TLE error.
### How to use
Example taken from [g4g](https://www.geeksforgeeks.org/unordered_map-in-cpp-stl/)