Learning Roadmap
Hint
This article is still being edited and discussed. You are welcome to extend the roadmap or to share your ideas in the comments!
This article lays out a learning roadmap for competitive programming.
The roadmap is both a guide for beginners learning competitive programming and a checklist for review.
1 C++ language basics
Start with C++ syntax and take it one step at a time.
1.1 Hello, World!
Let a single Hello, World! start your journey into competitive programming!
Along the way, see what the overall skeleton of a C++ source file looks like.
- Hello, World!
- C++ syntax basics
1.2 Variables and operators
Computers were first built to compute, so let us begin by learning how to carry out some simple calculations.
- Variables
- Operators
1.3 Control flow
1.3.1 Branching
Sometimes we need to execute different statements under different conditions. That is what conditional statements are for.
- Branching
There are several kinds of conditional statement:
- the if statement
- the if-else statement
- the if-else if-else statement
- the switch statement
1.3.2 Loops
To execute a group of statements many times over, use a loop statement.
- Loops
There are several kinds of loop statement:
- the for statement
- the while statement
- the do-while statement
1.4 Arrays and structs
An array stores a large amount of data of the same type, while a struct bundles several variables together.
- Arrays
- Structs
1.5 Functions and recursion
Use functions to make your programs modular and cheaper to implement.
Recursion is a hurdle for every beginner: "a function calling itself" does not sound easy to grasp. Look closely at what actually happens, though, and you will find that a function calling itself is not essentially different from a function calling another.
- Functions
- Recursion & divide and conquer
2 CSP-J (junior level)
2.1 Enumeration and simulation
By now you can use C++ to complete some simple tasks, but that is far from enough.
To get even easy problems right, you need to learn to write code by enumerating the possibilities or by simulating the logic you have in your head. This may not look very efficient, but sometimes it works well.
2.2 Recursion and divide and conquer
Recursion is the technique of a function calling itself, again and again, inside its own definition. Divide and conquer repeatedly splits a problem into several subproblems, solves them and combines the results.
2.3 Strings
Strings are a data type you will meet often in OI problems, so you need to learn some of the STL functions for manipulating them. Simulation is, of course, also a good way to solve string problems.
- String basics
- STL functions
2.4 Sorting
Given a set of data, how to put it in order is an important problem in its own right. When you are out of ideas, try sorting the array. Sorting is also the foundation of many of the algorithms that follow.
There are quite a few sorting methods, but once you understand them they are not hard to remember.
- Introduction to sorting
- Selection sort
- Bubble sort
- Insertion sort
- Counting sort
- Radix sort
- Quicksort
- Merge sort
- Heapsort
- Bucket sort
- Sorting in the STL
At the junior level the NOI syllabus requires only three sorting algorithms: selection sort, bubble sort and insertion sort. The others are not much harder and may come up in the preliminary round, so they are listed here as well.
2.5 Binary search and binary lifting
Binary search is, in essence, an application of divide and conquer: it keeps shrinking the search range until it finds the answer. Note, however, that it can only be applied to an ordered data structure.
Binary lifting is different: it works by repeated doubling, which turns a linear amount of work into a logarithmic one and greatly improves the time complexity. (This topic needs a little mathematical background; skipping it for now does no harm.)
2.6 Search
In the junior division, search most often appears in maze problems, whose data is usually some kind of map. Search is also widely used to enumerate efficiently the ways of constructing a valid solution, and it can serve for fishing for partial points as well.
2.6.1 Depth-first search (DFS)
Depth-first search here means an algorithm that uses a recursive function as a convenient way to implement brute-force enumeration. It has something in common with the DFS algorithm of graph theory, but the two are not quite the same.
- DFS (search)
2.6.2 Breadth-first search (BFS)
Model each state as a vertex of a graph, and you can carry out a blanket search.
- BFS (search)
2.6.3 Search optimization
Many problems can be solved with DFS, but its complexity is clearly too high to pass. It needs optimizations to run faster. Optimizations that cut down on attempts that cannot possibly succeed are called pruning. Optimizations for BFS are more varied, but the basic idea is the same.
- Pruning optimizations for DFS
2.7 Introduction to data structures
2.7.1 Linear data structures
Arrays, linked lists, queues and stacks are all linear structures. Used cleverly, they make a good many tasks easy.
- Stack
- Queue
- Linked list
2.7.2 Complex data structures
- Trees and binary trees
- Graph concepts
- Graph representation
2.8 Introduction to dynamic programming
Dynamic programming (DP) solves a complex problem by breaking it down into relatively simple subproblems.
Dynamic programming is not a specific algorithm but a method for solving a particular kind of problem. It therefore turns up on all sorts of data structures, and the problems that involve it are all the more varied.
- Introduction to dynamic programming
2.8.1 The knapsack problem
You are given a knapsack of limited capacity and a number of items, each with a capacity and a value; choose which items to put in so that their total value is as large as possible. This is the first hurdle that stops many OIers: from here on, the algorithms become somewhat hard to understand.
- Knapsack DP
2.8.2 Linear DP
One of the hardest parts of dynamic programming is designing the state, which calls for constructive techniques. Once you have written down the state and the recurrence, finishing a DP problem is not hard.
- Constructive problems
- Dynamic programming basics
Memoization is a way of implementing a search that records information about the states already visited, so that no state is explored twice. For some problems it also makes the solution easier to think through.
Because memoization guarantees that each state is visited only once, it is also a common way to implement dynamic programming.
- Memoization
2.8.3 Complex dynamic programming
Interval DP is an extension of linear DP. When it partitions the problem into stages, a great deal depends on the order in which the elements appear within a stage and on which elements of the previous stage were merged to produce them.
- Interval DP
2.9 Mathematics
2.9.1 Arbitrary-precision arithmetic
What if even long long (or int64) is not enough? Use arbitrary-precision arithmetic. In essence it just simulates the four basic arithmetic operations.
- Arbitrary-precision arithmetic
2.9.2 Base conversion
Besides binary, computers commonly use octal and hexadecimal. Knowing how to work in the right base can sometimes be a great help in solving a problem.
- Positional notation
2.9.3 Bit manipulation
Bit manipulation means operating on the binary representation of integers. Because computers store data in binary internally, these operations are very fast.
There are 6 basic bit operations: bitwise AND, bitwise OR, bitwise XOR, bitwise NOT, left shift and right shift.
- Bit manipulation
2.9.4 Number theory
- Number theory basics
- Prime numbers
- Sieves
- Greatest common divisor
- Euler's totient function
- Integer factorization
2.9.5 Combinatorial counting
- Permutations and combinations
- Pigeonhole principle
- Inclusion–exclusion principle
You have now learned every algorithm within the scope of the junior division. To master them, though, you need to go on practicing problems, and enough of them, to consolidate what you have learned.
This page is an unofficial English translation of the original OI Wiki page (revision 9bb3a8e6), machine-translated by Claude Fable 5.2 on 2026-11-16. It has been modified from the original by translation and may contain errors. It is not endorsed by OI Wiki.
Found a translation problem? Report it on GitHub.
Authors of the original page: NachtgeistW, StudyingFather, 24OI-bot, Konano, cbw2007, Enter-tainer, ksyx, CLCK0622, Tiphereth-A, Great-designer, CCXXXI, yuhuoji, c-forrest, TOMWT-qwq, hhc0001 (full contribution history)
All content on this page is provided under the terms of CC BY-SA 4.0 and SATA; additional terms may apply.