diff --git a/guide/english/cplusplus/map/index.md b/guide/english/cplusplus/map/index.md index d4659e05ee2..5376574018d 100644 --- a/guide/english/cplusplus/map/index.md +++ b/guide/english/cplusplus/map/index.md @@ -121,8 +121,20 @@ for(it=first.begin(); it!=first.end(); ++it){ } ``` -Here you can learn more about map: cpluspluc_map - N.B: All code in example are in C++11 version. You can learn more about C++ version Here +## Unordered Map +There exists another associative container similar to `map`, named `unordered_map`, which is implemented using a Hash Table as opposed to a balanced binary tree as is the case with `map`. The key values of the `unordered_map` are hashed into indices of the hash table. Unlike `map` the elements of `unordered_map` are not stored in a sorted manner. All operations permissible on `map` are applicable to `unordered_map` as well. + +## Benefits of Unordered Map +* Average Cost of insert, delete, search is O(1) if there are no hash collisions. +* Implemented using Hash Table + +## Unordered Map vs Map +* Unordered Map is faster if you want single element access. +* Use map when you want to traverse through key values in a sorted fashion or if you want some kind of ordering in the map. +* Unordered Map has more memory overhead, although it is typically negligible. + +## References: +For more information about the differences between `map` and `unordered_map`: Map vs Unordered Map