Module 06 of 10

STL: Containers & Algorithms

Lessons

About This Module

The Standard Template Library (STL) gives C++ ready-made containers and algorithms built on the templates from the previous module. This module starts with std::vector, the dynamic array you will reach for most often, and then looks at how to use it efficiently by avoiding needless copies and reallocations.

It then covers std::map and std::unordered_map, the key-value containers, including how to choose between them and how to use your own types as keys. The last lesson explains iterators, the glue that lets algorithms work with any container.

Watch the lessons in order, then continue on to Modern C++ (11 to 23).

Lessons

4 videos
01

Dynamic Arrays in C++ (std::vector)

How std::vector stores a growing list of elements, how it resizes, and the everyday operations you will use.

02

Optimizing the Usage of std::vector in C++

Why vectors copy elements when they grow, and how reserve and emplace_back remove that extra work.

03

Maps in C++ (std::map and std::unordered_map)

Storing key-value pairs, writing a hash function and a less-than operator for custom types, and choosing the right map for performance.

04

Iterators in C++

What iterators are, how they let you traverse any container, and how they connect containers to algorithms.