I was solving a problem and here comes a new thing about map. Do map of string, integer stores strings in alphabetical order if strings are key and integers are value?
Read the documentation which says:
Internally, the elements in a map are always sorted by its key following a specific strict weak ordering criterion indicated by its internal comparison object (of type Compare).
Yes, map in STL keeps the data in a sorted order. You can use unordered_map, it stores the data in same order as it is inserted.