Please explain…
What is the difference between unordered_map and unordered_set?
They are nearly identical. unordered_set
only contains keys, and no values. There is no mapping from a key to a value, so no need for an operator[]
. unordered_map
maps a key to a value.
You can use the various find
methods within unordered_set
to locate things.
refer this for more details on their member function and properties : -
http://www.cplusplus.com/reference/unordered_set/unordered_set/
http://www.cplusplus.com/reference/unordered_map/unordered_map/
Is their time complexity same?