#include <map>
=> Header to includemap<dataType1, dataType2> variable;
=> Initialization of Map#include <unordered_map>
=> Header to includeunordered_map<dataType1, dataType2> variable;
=> Initialization of Unordered Mapmultimap <int, int> var
=> Same as Map but can contain duplicate keysvariable[key] = value
variable.insert({key, value})
=> Inserts element in the mapvariable.insert(make_pair(key, value))
variable[key]
=> Returns value of that key, If key not present then creates an entry with that key and value 0 and Returns 0variable.at(key)
=> Returns value of that key, Returns error if key not presentvariable.size()
=> Returns sizevariable.count(key)
=> Returns 1 if element is present, 0 if not presentvariable.erase(key)
=> Deletes the given key value pairvariable.clear()
for(auto var1: variable) {
cout << var1.first << " " << var1.second << endl;
}
map<int, int> :: iterator it;
=> Declare an iteratorauto it = variable.find(value)
=> Returns iterator to that elementvariable.begin()
=> Returns iterator pointing to the first elementvariable.end()
=> Returns iterator pointing to element next to the last element