ReviseAlgo Logo

Standard Template Library (STL)

14 Topics
1

STL Overview

Introduction to containers, iterators, algorithms

Foundation for STL
2

std::vector

Dynamic array container

Most used container
3

std::list

Doubly linked list — O(1) insertion/deletion anywhere with iterator stability

Trade-offs vs vector — when cache efficiency matters less than insertion stability
4

std::deque

Double-ended queue with O(1) push/pop at both ends and random access

When you need efficient front and back operations — the underlying container for std::stack and std::queue by default
5

std::stack and std::queue

LIFO and FIFO container adaptors built on top of other containers

Classic data structures — DFS uses stack, BFS uses queue; always tested in graph/tree problems
6

std::priority_queue

Max-heap by default — O(log n) push/pop, O(1) top access

One of the most-used containers in coding interviews — Dijkstra, top-K problems, merge K sorted lists
7

std::set and std::multiset

Ordered tree-based containers for unique (set) or duplicate (multiset) sorted elements

Sorted unique elements, O(log n) operations, and ordered iteration — common in sliding window and interval problems
8

std::map and std::multimap

Ordered key-value pairs in a red-black tree — O(log n) operations with sorted iteration

Essential associative container — frequency counting, LRU adjacency lists, and ordered key queries
9

Unordered Containers

Hash-based unordered_set and unordered_map with O(1) average operations

Most-used containers in interview solutions — O(1) lookup for frequency counting, deduplication, and caching
10

Iterators

Generalized pointers for traversing STL containers — the glue between containers and algorithms

Fundamental STL concept — iterator invalidation rules are a common interview trap
11

STL Algorithms

Generic algorithms that operate on ranges via iterators — sort, find, transform, and more

STL fluency is expected — using algorithms instead of raw loops signals C++ expertise
12

std::pair and std::tuple

Lightweight heterogeneous aggregates for grouping multiple values

Ubiquitous in interview solutions — returning multiple values, map entries, priority queue elements
13

std::optional and std::variant

C++17 sum types — optional values and type-safe tagged unions

Modern error handling and type safety — shows knowledge of C++17 value semantics
14

Ranges (C++20)

Lazy, composable range-based algorithms and views — the modern STL

Cutting-edge C++20 — shows awareness of modern idioms and pipeline-style data transformations