Question: what is the difference between map and pair in c++?
Answer: Map can provide the better searching time in the range of O(log n), whilw list can have the searching time of O(n). std::pair is just for grouping together exactly 2 objects (say, "coordinates on a page" is comprized of X and Y). ... However, you CAN use std::pair as a map value if that's what you want.