Efficient algorithm for intersection of map disorderly using key
What is the most efficient way to intersect two maps by key?
Eg.: Given
map<int, float> m1;
map<int, float> m2;
m1[1] = 1.0;
m1[2] = 4.0;
m1[3] = 3.0;
m1[7] = 5.0;
m2[7] = 3.0;
m2[4] = 2.0;
m2[2] = 4.0;
m2[9] = 6.0;
I need an vector<int> with the result of the intersection!
The expected result will be: 2 and 7
No comments:
Post a Comment