# **[](https://en.cppreference.com/w/cpp/header/unordered_map)** is a hash table of key-value pairs with O(1) average insertion, deletion, and lookup. Keys are unordered, but you can iterate and access by key quickly. Use `unordered_map` when you need fast lookup by key; use `std::map` if you need sorted order. ## Example This example uses an unordered_map to count word frequencies, demonstrating fast insertion and lookup without order guarantees. ```cpp // compile: g++ -std=c++11 -o unorderedmapexample unorderedmapexample.cpp // run: ./unorderedmapexample // description: hash table map operations #include #include #include int main() { std::unordered_map count; count["apple"]++; count["banana"]++; count["apple"]++; for (const auto& [fruit, num] : count) { std::cout << fruit << ": " << num << "\n"; } std::cout << "apple count: " << count["apple"] << "\n"; return 0; } ```