Maps in C++

Any has any info about any good resource that explains how to use maps from absolute basics in C++ to solve like subarray kind of questions in an optimized manner?

I personally use cppreference to learn most of the things. Its a little tough to get used to it, but once you do, you will not need to go anywhere else.

The STL playlist by cppnuts on youtube is also a great one. Scroll down to find map and multimap tutorials.

1 Like

map, set, and all the things that are using the name map and set in C++ are usually very slow because they use a LinkedList under the hood. If you are resolving a problem that you must use the map, I suggest you use Java HashMap.

Also because the map and in C++ implements the RB tree in an efficient way (When you are trying to get the information not when you are trying to push information inside)

Iā€™m working on a copy and past implementation of the RB tree on this repository GitHub - vincenzopalazzo/cpstl: Copy and Paste standard library (CPSTL) is a repository with a collection of data structure and algorithms in many different languages

Of course the @gamma30 answer contains a good reference to see how use the map in C++