Competitive Programmer's Handbook

written by Antti Laaksonen

The purpose of this book is to give the reader a thorough introduction to competitive programming. The book is especially intended for students who want to learn algorithms and possibly participate in the International Olympiad in Informatics (IOI) or in the International Collegiate Programming Contest (ICPC).

Download the book (PDF)

A more comprehensive printed book Guide to Competitive Programming has now been published. It is based on this online book, but also discusses more advanced topics such as suffix arrays, treaps, dynamic programming optimization, and parallel binary search. You can buy the book, for example, through Springer or Amazon.

Table of contents

Part 1: Basic techniques

  1. Introduction
  2. Time complexity
  3. Sorting
  4. Data structures
  5. Complete search
  6. Greedy algorithms
  7. Dynamic programming
  8. Amortized analysis
  9. Range queries
  10. Bit manipulation

Part 2: Graph algorithms

  1. Basics of graphs
  2. Graph traversal
  3. Shortest paths
  4. Tree algorithms
  5. Spanning trees
  6. Directed graphs
  7. Strong connectivity
  8. Tree queries
  9. Paths and circuits
  10. Flows and cuts

Part 3: Advanced topics

  1. Number theory
  2. Combinatorics
  3. Matrices
  4. Probability
  5. Game theory
  6. String algorithms
  7. Square root algorithms
  8. Segment trees revisited
  9. Geometry
  10. Sweep line algorithms