Time complexity of insertion in map< vector< int > , int > ?

Revision en5, by 175iq, 2020-04-06 07:45:04

I recently found out that inserting a vector in a map is possible :

map< vector<int>, int > mp;
vector<int> vec = {1,2,3,4,5};
mp[vec] = 5;
cout<<mp[vec];
// prints 5
  1. If there are N vectors in mp present as keys already, what is the time complexity to insert a new vector of size M in mp ? Is it O(M*log(N) or something else depending upon the sizes of vectors present in mp already?
  2. What would be the time complexity of a query operation such as mp[vec]? Please help.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en6 English 175iq 2020-04-06 13:38:40 4 Tiny change: 'resent in mp already?\' -> 'resent in ``mp`` already?\'
en5 English 175iq 2020-04-06 07:45:04 26 Tiny change: 'ert a new vector of size `' -> 'ert a new ``vector`` of size `'
en4 English 175iq 2020-04-05 23:02:08 2
en3 English 175iq 2020-04-05 23:01:20 5
en2 English 175iq 2020-04-05 23:00:42 9
en1 English 175iq 2020-04-05 22:59:15 576 Initial revision (published)