Course offer · HLD · LLD · System Design at ₹799 until 30 Nov (not interview packs)

ProgramsC++

STL Containers Programs

C++ STL container programs with output: vector, 2D vector, map, set, unordered_map, stack, queue, priority_queue, and deque, with when to pick each one.

10 programs · open one, then the next

Start with Vector Basics
  1. 01Vector BasicsBeginnerLearn C++ vector basics: push_back, [] versus at(), front and back, size versus capacity, initializer lists, range-based for loops, and pop_back, with output.Open example →
  2. 02Vector OperationsIntermediateC++ vector operations with STL algorithms: sort, reverse, find with distance, insert and erase at an index, and clear. Learn the cost of each one.Open example →
  3. 032D VectorIntermediateBuild a 2D vector in C++: size it with resize, fill it with nested loops, initialize with nested braces, read matrix[i][j], and handle rows of different lengths.Open example →
  4. 04Map BasicsBeginnerC++ map basics with sorted keys: insert with [], read with at(), test keys with find and count, erase a key, and see why [] silently adds missing keys.Open example →
  5. 05Set BasicsBeginnerC++ set basics: unique, sorted values with insert, find, count, and erase, plus lower_bound and upper_bound to find the nearest value. Includes the exact output.Open example →
  6. 06Unordered Map and SetIntermediateUse unordered_map and unordered_set in C++: hash tables with O(1) average lookups, unspecified order, ignored duplicates, buckets, and load factor.Open example →
  7. 07Stack BasicsBeginnerC++ stack basics with LIFO order: push, top, pop, size, and empty, plus two classic uses: reversing a string and checking balanced parentheses, with output.Open example →
  8. 08Queue BasicsBeginnerC++ queue basics with FIFO order: push to the back, read front and back, pop from the front, and process a task list the same way BFS walks a graph.Open example →
  9. 09Priority QueueIntermediateC++ priority_queue explained: a max-heap by default, a min-heap with greater<int>, and a lambda comparator, with why the comparator direction feels backwards.Open example →
  10. 10Deque (Double-ended Queue)IntermediateC++ deque (double-ended queue) basics: push and pop at the front and back, index with [] and at(), insert and erase in the middle, and how it differs from vector.Open example →