A structured roadmap from programming fundamentals to advanced algorithmic problem-solving, covering data structures, algorithms, mathematical techniques, and contest strategies used in competitions like ICPC, Codeforces, and IOI.
§ SYLLABUS
- 01Language Mastery & Fast I/O
Choose a competition language (C++ recommended), master its STL, and learn fast input/output techniques to avoid TLE on large inputs.
- 02Brute Force & Complete Search
Learn to enumerate all possible solutions systematically. Understand when brute force is viable and how to prune the search space.
- 03Greedy Algorithms
Understand the greedy paradigm: making locally optimal choices and proving they lead to globally optimal solutions via exchange arguments.
- 04Foundations Complete
You can solve ad-hoc and implementation problems, use greedy reasoning, and handle I/O efficiently.
- 01Time & Space Complexity
Analyze algorithms using Big-O notation. Learn to estimate whether a solution will pass within time and memory limits before coding it.
- 02Amortized Analysis
Understand how to analyze sequences of operations where individual steps may be expensive but the average cost is low, such as dynamic arrays and union-find.
- 01Arrays, Stacks & Queues
Master linear data structures, their operations, and classic applications like matching parentheses, next-greater-element, and sliding window problems.
- 02Sets, Maps & Hash Tables
Use balanced BSTs and hash maps for fast lookup, counting, and coordinate compression. Understand when to choose ordered vs unordered containers.
- 03Priority Queues & Heaps
Learn heap operations and applications: Dijkstra's algorithm, event simulation, greedy scheduling, and the k-th element pattern.
- 04Disjoint Set Union (Union-Find)
Implement DSU with path compression and union by rank. Apply it to connectivity queries, Kruskal's MST, and online graph problems.
- 05Data Structures Solid
You can choose the right data structure for a problem and implement it correctly under time pressure.
- 01Binary Search
Apply binary search on sorted data and on the answer space. Recognize monotonic predicates and use binary search to optimize brute-force solutions.
- 02Sorting Techniques & Applications
Use sorting as a preprocessing step. Learn merge sort for inversion counting, custom comparators, and coordinate compression via sorting.
- 03Two Pointers & Sliding Window
Solve subarray and subsequence problems in linear time by maintaining two pointers or a sliding window over sorted or sequential data.
- 01Introduction to DP
Understand memoization vs tabulation, identify overlapping subproblems and optimal substructure, and solve classic problems like Fibonacci, knapsack, and LCS.
- 02Classical DP Patterns
Master common DP patterns: interval DP, digit DP, bitmask DP, and DP on subsets. Learn to define states and transitions for each pattern.
- 03DP Optimization Techniques
Speed up DP using divide-and-conquer optimization, Knuth's optimization, convex hull trick, and the SMAWK algorithm for specific recurrence structures.
- 04DP Proficient
You can model most problems as DP, identify the right state representation, and optimize transitions when needed.
- 01Graph Representation, BFS & DFS
Represent graphs with adjacency lists. Implement BFS for shortest paths in unweighted graphs and DFS for cycle detection, topological sorting, and connected components.
- 02Shortest Path Algorithms
Implement Dijkstra, Bellman-Ford, and Floyd-Warshall. Know when to use each based on graph properties (negative weights, all-pairs, sparse vs dense).
- 03Minimum Spanning Trees
Find MSTs using Kruskal's (with DSU) and Prim's algorithms. Understand applications and properties like the cut and cycle properties.
- 04Tree Algorithms
Solve problems on trees: diameter, LCA (binary lifting), Euler tour, subtree queries, and rerooting technique for tree DP.
- 05Network Flow & Matching
Implement max-flow algorithms (Ford-Fulkerson, Dinic's) and understand min-cut duality. Apply to bipartite matching and assignment problems.
- 06Graph Algorithms Complete
You can model real problems as graphs and apply the right traversal, shortest-path, or flow algorithm.
- 01Modular Arithmetic
Perform arithmetic under a modulus: fast exponentiation, modular inverse, and handling large numbers that require mod 10^9+7.
- 02Primes & Sieve of Eratosthenes
Generate primes efficiently, factorize numbers, and apply prime-related techniques like Euler's totient function and divisor enumeration.
- 03Combinatorics & Counting
Compute combinations, permutations, and Catalan numbers. Apply inclusion-exclusion and the pigeonhole principle to counting problems.
- 04Game Theory (Sprague-Grundy)
Analyze combinatorial games using Grundy numbers and the Sprague-Grundy theorem. Solve Nim variants and impartial games.
- 01String Hashing
Use polynomial rolling hashes for fast substring comparison. Handle collision avoidance with double hashing and apply to pattern matching and palindrome detection.
- 02KMP & Z-Algorithm
Find pattern occurrences in linear time using prefix functions (KMP) or Z-arrays. Understand failure function construction and applications.
- 03Tries
Build prefix trees for efficient string lookups, autocomplete, and XOR-maximum queries. Extend to persistent tries when needed.
- 04Suffix Arrays & Automata
Construct suffix arrays in O(n log n) and use LCP arrays for substring problems. Understand suffix automata for advanced string tasks.
- 01Segment Trees
Build segment trees for range queries and point/range updates. Master lazy propagation and apply to problems like range sum, min, max, and GCD.
- 02Binary Indexed Tree (Fenwick Tree)
Use BIT for prefix sum queries and point updates in O(log n). Understand its simplicity advantage over segment trees for certain problems.
- 03Square Root Decomposition & Mo's Algorithm
Divide data into blocks of size √n for offline range queries. Apply Mo's algorithm to answer range queries without updates efficiently.
- 04Computational Geometry
Implement point, line, and polygon operations. Solve convex hull, line intersection, and closest pair problems with robust floating-point handling.
- 05Advanced Techniques Mastered
You can handle hard competition problems requiring advanced data structures, string algorithms, and mathematical reasoning.
- 01Problem-Solving Strategies
Develop a systematic approach: read carefully, identify problem type, consider edge cases, estimate complexity, and choose the right technique before coding.
- 02Debugging & Stress Testing
Write brute-force solutions and random test generators to find bugs via stress testing. Learn to debug efficiently under time pressure.
- 03Contest Ready
You have the algorithmic toolkit and practical skills to compete effectively in Codeforces Div 2, ICPC regionals, and similar competitions.