Appearance
Chapter 0: Fundamentals
This is where everything begins. Before you can think about algorithms, you need fluency in C++, comfort with complexity analysis, and muscle memory for the STL. This chapter gives you the vocabulary and tools that show up in every single contest solution — from reading input fast enough to avoid TLE, to encoding subsets as bitmasks for brute-force searches. If you skip this chapter, you'll constantly trip over language mechanics instead of focusing on the actual problem.
Going to: Chapter 1 — Essential Techniques — core problem-solving techniques like binary search, greedy, and prefix sums
Bridge: BRIDGE-to-techniques.md — why fundamentals matter before learning techniques
Topics at a Glance
| # | Topic | Difficulty | Key Trigger Phrase |
|---|---|---|---|
| 01 | C++ Language Essentials | Beginner | "How do I write idiomatic C++ for contests?" |
| 02 | Fast I/O and Pragmas | Beginner | TLE on correct solution → slow I/O |
| 03 | Complexity Analysis | Beginner | "Will O(n²) pass for n = 10⁵?" |
| 04 | Arrays and Strings | Beginner | Any problem with sequences or text |
| 05 | STL Containers | Beginner | "Which container gives me O(log n) lookups?" |
| 06 | STL Algorithms | Beginner | "Is there a built-in for this?" |
| 07 | Bit Manipulation | Intermediate | n ≤ 20 + "subsets" or "choose elements" |
| 08 | Bitset Optimization | Intermediate | "Need O(n/64) speedup on boolean vectors" |
| 09 | Math Toolkit | Beginner | GCD, power, factorials in contest code |
| 10 | Modular Arithmetic Basics | Beginner | "Print answer mod 10⁹+7" |
| 11 | Recursion and Backtracking | Beginner | "Generate all" + small n (≤ 20) |
| 12 | Graph and Tree Intro | Beginner | First encounter with nodes and edges |
| 13 | Debugging and Stress Testing | Beginner | WA on test 3 and you can't see why |
| 14 | Bitset Tricks | Intermediate | "O(n²) TLE, bitset gives 64x speedup" |
If You Only Read 3 Files
- Complexity Analysis — because reading constraints and knowing whether O(n²) will pass is the first thing you do on every problem. Get this wrong and nothing else matters.
- STL Containers — because choosing between
vector,map,set, andunordered_mapis a decision you'll make dozens of times per contest. Know the tradeoffs cold. - Recursion and Backtracking — because recursive thinking is the foundation for DFS, DP, and divide-and-conquer. If you can't think recursively, Chapters 3 and 4 will be a wall.
Cross-Chapter Connections
- After Bit Manipulation here, you're ready for DP — Bitmask in Chapter 4
- After Recursion and Backtracking, continue to DP Thinking Framework — DP is recursion + memoization
- After Graph and Tree Intro, jump to Graph Representation in Chapter 3
- After Modular Arithmetic Basics, deepen your skills in Number Theory in Chapter 7
- Debugging and Stress Testing pairs well with Debugging Under Pressure in Chapter 11
File Listing
| File | Topic | Level |
|---|---|---|
| cpp-language-essentials | C++ Language Essentials | ⭐ |
| complexity-analysis | Complexity Analysis | ⭐ |
| arrays-and-strings | Arrays and Strings | ⭐ |
| stl-containers | STL Containers | ⭐ |
| stl-algorithms | STL Algorithms | ⭐ |
| math-toolkit | Math Toolkit | ⭐ |
| modular-arithmetic-basics | Modular Arithmetic Basics | ⭐ |
| recursion-and-backtracking | Recursion and Backtracking | ⭐ |
| graph-and-tree-intro | Graph and Tree Intro | ⭐ |
| bit-manipulation | Bit Manipulation | ⭐⭐ |
| bitset-optimization | Bitset Optimization | ⭐⭐ |
| fast-io-and-pragmas | Fast I/O and Pragmas | ⭐ |
| debugging-and-stress-testing | Debugging and Stress Testing | ⭐ |
| bitset-tricks | Bitset Tricks for CP | ⭐⭐ |
Suggested Reading Order
- Complexity Analysis — learn to estimate what will pass within time limits
- Arrays and Strings — the most common data types in every problem
- STL Containers — when to use vector, map, set, queue
- STL Algorithms — replace manual loops with standard library calls
- Recursion and Backtracking — think recursively and prune branches
- Bit Manipulation — encode sets as integers for subset enumeration
- Bitset Optimization — squeeze O(n/64) speedups with std::bitset
- Fast I/O and Pragmas — avoid TLE from slow I/O
- Debugging and Stress Testing — systematic bug-finding techniques
- C++ Language Essentials — C++ features every CP coder needs
- Math Toolkit — essential math formulas for competitive programming
- Modular Arithmetic Basics — handle "mod 10⁹+7" problems correctly
- Graph and Tree Intro — visual dictionary of graph and tree vocabulary
- Bitset Tricks — competitive programming bitset recipes for 64x speedups