Learn about the most common STL container classes.
Containers are the heart of the STL. **`std::vector`** is a dynamic array. It stores elements in contiguous memory, allowing for fast random access (accessing any element by its index). It can grow or shrink in size automatically. You typically add elements to the end using `.push_back()`. It's the most commonly used container and should be your default choice unless you have a specific reason to use something else. **`std::list`** is a doubly-linked list. Its elements are not stored contiguously in memory. This means it does not support fast random access, but it excels at fast insertion and deletion of elements anywhere in the list. **`std::map`** is an associative container that stores elements as key-value pairs, sorted by the key. This allows for efficient lookup, insertion, and deletion of elements based on their key. For example, you could map student names (keys) to their grades (values). It's typically implemented as a balanced binary search tree. **`std::set`** is another associative container that stores a collection of unique elements, also in sorted order. It's useful when you need to store a group of items and quickly check for the presence or absence of a specific item. All these containers are class templates, so you must specify the type of data they will hold, e.g., `std::vector<int>`, `std::map<std::string, double>`.