About this Reference¶
This cheatsheet is designed to be your single tab during a contest: every algorithm, every data structure, every C++ trick organised so you can find what you need in seconds.
Every page follows the same convention:
- Explanation paragraph above each block: brief, dense, no fluff
- Inline comments only for non-obvious lines: code stays readable
- Complexity table at the top of each section: best / average / worst / space / stability
- Copy button on every code block: one click, paste into your IDE
- Admonitions (
note,tip,warning) call out gotchas and edge cases
Tier Coverage¶
T1 · Foundations (Files 01–06)¶
Target level: LeetCode Easy/Medium, CF Div2 A–B
| File | Title | Key Topics |
|---|---|---|
| 01 | Language Fundamentals | I/O optimisation, auto, range-for, lambdas, structured bindings, move semantics, constexpr, using aliases, header includes |
| 02 | STL Containers | vector, deque, list, set, multiset, map, multimap, unordered_map, unordered_set, stack, queue, priority_queue — construction, iteration, common operations |
| 03 | STL Algorithms & Utils | sort, binary_search, lower_bound, upper_bound, accumulate, count_if, transform, min_element, max_element, next_permutation, rotate, unique, __gcd, __builtin_popcount |
| 04 | Sorting Algorithms | Bubble, selection, insertion, merge sort, quick sort, heap sort, counting sort, radix sort — with complexity tables and stability notes |
| 05 | Searching Algorithms | Linear search, binary search (standard, lower/upper bound, rotated array), ternary search, exponential search |
| 06 | Recursion, Backtracking & D&C | Recursion fundamentals, N-queens, sudoku solver, permutations/subsets, divide-and-conquer patterns, master theorem |
T2 · Core DSA (Files 07–09, 11, 14, 19)¶
Target level: FAANG interviews, CF Div2 C
| File | Title | Key Topics |
|---|---|---|
| 07 | Linked Lists | Singly/doubly linked lists, reversal, cycle detection (Floyd's), merge two sorted lists, find middle, LRU cache via list |
| 08 | Stacks, Queues & Deques | Monotonic stack, next greater element, largest rectangle in histogram, sliding window maximum (deque), circular queue |
| 09 | Trees & BST | BFS/DFS traversals, diameter, LCA (naive), BST insert/delete/search, balanced BST, Morris traversal, path sum problems |
| 11 | Graphs Basics | Adjacency list/matrix, BFS, DFS, connected components, bipartite check, topological sort (Kahn's + DFS), cycle detection |
| 14 | Greedy Algorithms | Activity selection, fractional knapsack, job scheduling, Huffman coding, interval merging, jump game |
| 19 | Bit Manipulation | AND/OR/XOR tricks, bit shifting, check/set/clear/toggle bits, count set bits, power of 2, subset enumeration via bitmask |
T3 · Advanced (Files 10, 12, 13, 15, 18)¶
Target level: CF Div2 D, FAANG Hard
| File | Title | Key Topics |
|---|---|---|
| 10 | Advanced Trees | AVL tree rotations, Red-Black trees (concept), segment tree (point/range update, range query), Fenwick tree (BIT), persistent segment tree, merge sort tree |
| 12 | Graphs: Shortest Paths | Dijkstra (binary heap), Bellman-Ford, SPFA, Floyd-Warshall, Johnson's algorithm, 0-1 BFS, multi-source BFS |
| 13 | Graphs: Advanced | SCC (Kosaraju, Tarjan), bridges and articulation points, Euler path/circuit, DSU (Union-Find with path compression + rank), 2-SAT |
| 15 | Dynamic Programming | 1D/2D DP, knapsack variants, LIS, LCS, edit distance, matrix chain, interval DP, bitmask DP, DP on trees, digit DP, broken profile DP |
| 18 | Advanced Data Structures | DSU extensions, segment tree with lazy propagation, Sparse Table (RMQ), sqrt decomposition, Mo's algorithm, treap, skip list |
T4 · CP Competitive (Files 16, 17, 21)¶
Target level: CF Div1 C–D, ICPC regionals
| File | Title | Key Topics |
|---|---|---|
| 16 | Number Theory & Math | GCD/LCM, prime sieve, factorisation, modular arithmetic, fast power, modular inverse, CRT, Euler's totient, Mobius function, Catalan numbers, combinatorics |
| 17 | String Algorithms | KMP, Z-function, Rabin-Karp, trie, suffix array (SA-IS), suffix automaton, Aho-Corasick, palindrome (Manacher's, Eertree), hashing |
| 21 | Game Theory | Nim, Sprague-Grundy theorem, Nim with k moves, Wythoff's game, Green Hackenbush, misere Nim, Zeckendorf, combinatorial game composition |
T5 · Elite 2000+ (Files 20, 22, 23)¶
Target level: CF 2000+, IOI
| File | Title | Key Topics |
|---|---|---|
| 20 | Geometry | Coordinate geometry primitives, convex hull (Graham, Jarvis), rotating calipers, polygon area/centroid, point-in-polygon, line intersection, closest pair, half-plane intersection |
| 22 | CP Tricks & Templates | Competitive template, fast I/O macros, HLD (Heavy-Light Decomposition), centroid decomposition, virtual tree, CHT (Convex Hull Trick), Li Chao tree, max flow (Dinic's), min-cost flow, interactive problem patterns |
| 23 | C++20/23 Features | Ranges library, std::views, std::span, concepts & constraints, coroutines (overview), std::format, std::flat_map, std::expected, std::mdspan |
Search shortcut
Press / or S to open search and find any algorithm, data structure, or keyword instantly across all 23 files.