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

Правка en2, от 175iq, 2020-04-05 23:00:42

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.

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en6 Английский 175iq 2020-04-06 13:38:40 4 Tiny change: 'resent in mp already?\' -> 'resent in ``mp`` already?\'
en5 Английский 175iq 2020-04-06 07:45:04 26 Tiny change: 'ert a new vector of size `' -> 'ert a new ``vector`` of size `'
en4 Английский 175iq 2020-04-05 23:02:08 2
en3 Английский 175iq 2020-04-05 23:01:20 5
en2 Английский 175iq 2020-04-05 23:00:42 9
en1 Английский 175iq 2020-04-05 22:59:15 576 Initial revision (published)