- Map is a Data Structre which stores Key-value pair.
- Map is a container
- No two mapped values can have the same key values.
- Ordered Maps use Red Black Trees.
- Maps are not contious Example it++ is allowed while it+1 is not.
- All keys are unique if redeclaration happens the pair with that pre-existing key updates.
- Maps are implemented using Red-Black trees
- A red-black tree is a kind of self-balancing binary search tree where each node has an extra bit, and that bit is often interpreted as the colour (red or black).
- To read in depth about the Red-Black Tree : https://www.geeksforgeeks.org/red-black-tree-set-1-introduction-2/
- Maps contains many function but mainly begin(),end(),size(),empty(),find(),erase(),clear()
- begin() : Returns an iterator to the first element in the map.
- end() : Returns an iterator to the theoretical element that follows the last element in the map.
- size() : Returns the number of elements in the map.
- empty() : Returns whether the map is empty.
- erase(const g) : Removes the key-value βgβ from the map.
- clear() : Removes all the elements from the map.
- find() : Returns an iterator to the element with key-value βgβ in the map if found, else returns the iterator to end.
- To read more on functions : https://www.geeksforgeeks.org/map-associative-containers-the-c-standard-template-library-stl/