Competitive Programming

Overview of CP3

Total Chapters:

Number of Pages:
447+4 (cover)

Release Date:
24 May 2013

Selling price (Printed)
A5 Paperback: 19.99 USD (+Shipping Cost), Buy A5 Paperback
8.25 x 10.75 inch (~2xA5) Hard Cover: 29.99 USD (+Shipping Cost), Buy Hard Cover
CP3 hard copy version will be phased out very soon (in 2021)

Selling price (eBook)
If you cannot get CP4 (hard copy) yet, use the softcopy of the old CP3 as a stopgap measure Buy CP3 e-book

Book Sales Status at

Average daily sales: 9028/2555 (2013-2019) ~= 3.53 book(s)/day.

Contents of CP3

Chapter 1: Introduction
  1. A gentler intro: Anatomy of programming contest problem; Parsing Input/Formatting Output for beginners; Common errors; Common shortcut tricks
Chapter 2: Data Structures and Libraries
  1. NEW in 2013: Deque
  2. NEW in 2013: Many written exercises about basic data structures from Steven's other course in SoC, NUS
  3. Union Find Data Structure now uses 'union by rank' by default
  4. UFDS, Segment Tree, and BIT are now written in OOP fashion
Chapter 3: Problem Solving Paradigms
  1. NEW in 2013: iterative solution for subset and permutation problems
  2. Updated discussion nested loops and recursive backtracking (8 queens problem)
  3. NEW in 2013: discussion of one important trick for dealing with greedy problems: sorting
  4. Updated discussion of top-down and bottom-up DP
  5. NEW in 2013: Alternative way to code top-down DP and to print out top-down DP solution, inclusion of Kadane's algorithm for static 1D/2D range sum query
  6. Much more programming exercises with a better categorization system
Chapter 4: Graph
  1. Graph traversal and MST sections are revisited and rewritten to make the discussed algorithms clearer
  2. NEW in 2013: Example of (medium level) graph modeling for shortest path problem, network flow problem, and bipartite matching problem
  3. Discussion of Dinic's max flow algorithm (placed in Chapter 9), Hopcroft Karp's bipartite matching algorithm (also placed in Chapter 9), and important technique to improve the runtime of the Augmenting Path Bipartite Matching algorithm
  4. Much more programming exercises
Chapter 5: Mathematics
  1. Strengthening the explanation of various sections
  2. NEW in 2013: Techniques of using Java BigInteger, more collection of classic combinatorics problems
  3. Improved discussion of Matrix Power (now placed in Chapter 9)
  4. Insights on the faster Brent's cycle-finding algorithm and the Pollard's rho integer factoring algorithm (as exercise and in Chapter 9)
Chapter 6: String Processing
  1. NEW in 2013: New technique of using Java String class
  2. More collection of Ad Hoc string problems
  3. Further strengthening of Suffix Trie/Tree/Array explanation; the terminating symbol is restored
Chapter 7: (Computational) Geometry
  1. NEW in 2013: Several new geometric library routines are added
  2. Existing library routines are enhanced
Chapter 8: More Advanced Topics
  1. Reorder the sections so that the more advanced search and DP techniques are listed before problem decomposition (as it may involve those advanced search/DP techniques)
  2. NEW in 2013: Backtracking with Bitmask, State Space Search, Meet in the Middle
Chapter 9: Rare Topics
  1. Collection of (many, 34 of them) rare algorithms, data structures, and/or programming problems that have not been listed in the first eight chapters
  1. Discussion of ~1700 UVa + other OJ problems
  2. Some UVa problems are re-classified into sa better category :)

Buy Now!

Partner Links