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
- If there are
N
vectors
in mp present as keys already, what is the time complexity to insert a newvector
of sizeM
inmp
? Is itO(M*log(N)
or something else depending upon the sizes of vectors present in mp already? - What would be the time complexity of a query operation such as
mp[vec]
? Please help.