Competitive Programming

News (01 July 2024)

Associate Professor Steven Halim, one of the authors of Competitive Programming book is the new director of NUS Centre for Nurturing Computing Excellence (CeNCE)

Also, we are collecting testimonials for CP4 that may be used for CP5 preface (the more impressive your testimonial, the more likely it will be used).
FAQ: We may (or may not) eventually release our CP5 draft (we will only do so after we decide that the delta is sufficient, as of mid 2024, the delta is too small).

News (19 August 2022)

Finally, after two years and one month of exclusive printed-book only (19 July 2020-19 August 2022), we (CP4 book authors, Felix Halim, Suhendry Effendy) have decided to sell the (same) PDF source as eBook. There is no edit compared to the version published in 2020 (i.e., these two PDFs are the original version published back in 19 July 2020), but all known errata has been listed at Errata section.

So if your country/region does not have access to lulu distribution centers or if the shipping cost is too much to bear or if the printed font size is too small for your liking (but you have Internet access and credit card), then pick these alternative options:

PS: The eBook versions are 2 USD cheaper than the printed versions.

This is the companion web site for a book: "Competitive Programming 4: The Lower Bound of Programming Contests in the 2020s" (click here for details) and its three past editions written by myself (Steven Halim - UVa status, Kattis status, and also Clist open kattis status), my younger brother (Felix Halim - UVa status, Kattis status), and my friend (Suhendry Effendy - UVa status, Kattis status) in 2010 - present. This book is used in my course in School of Computing, National University of Singapore: CS3233 - Competitive Programming (2009-present) and available for wider audiences since 2010. This book contains a collection of competitive programming skills gained by solving more than 3900+ UVa (1999-present) plus Kattis (2015-present) online judge problems and being involved in the ICPCs (since 2001) and the IOIs (since 2009) in various roles: contestants (long ago), coaches/team leaders, judges/scientific committee members, ICPC Regional and Championship Contest Director (2015, 2018, 2025), and/or IOI International Committee member (2020-2021).


Our objective in writing this book is similar with the IOI objective+ICPC vision: to further improve humanity by training current students to be more competitive in programming contests. The possible long term effect is future Computer Science researchers who are well versed in problem solving skills. We use C++ (primary), Python (secondary), Java (tertiary), and OCaml (optional) code to illustrate the algorithmic concepts, i.e., we dislike vague pseudo-code commonly found in many other Computer Science textbooks. We also built and heavily use our-own visualization tool: VisuAlgo to help explain the data structure and algorithm concepts to our book readers and beyond.

Target Audiences

This Competitive Programming book, 4th edition (CP4) is a must have for every competitive programmer. Mastering the contents of this book is a necessary (but admittedly not sufficient) condition if one wishes to take a leap forward from being just another ordinary coder to being among one of the world's finest competitive programmers.

  • CP4, Book 1 (Chapter 1-4):
    • Secondary or High School Students who are competing in the annual International Olympiad in Informatics (IOI) (including the National or Provincial Olympiads) as Book 1 covers most of the current IOI Syllabus,
    • Casual University students who are using this book as supplementary material for typical Data Structures and Algorithms courses,
    • Anyone who wants to prepare for typical fundamental data structure/algorithm part of a job interview at top IT companies.
  • CP4, Book 1+2 (Chapter 1-9):
    • University students who are competing in the annual International Collegiate Programming Contest (ICPC) Regional Contests (including the Region Championship and the World Finals) as Book 2 covers much more Computer Science topics that have appeared in the ICPCs,
    • Teachers or Coaches who are looking for comprehensive training materials,
    • Anyone who loves solving problems through computer programs. There are numerous programming contests for those who are no longer eligible for ICPC, including Codeforces contest, Meta (Facebook) Hacker Cup (2011-present), Topcoder Open (2001-2023), Google Code Jam (2003-2022), Internet Problem Solving Contest (IPSC) (1999-2018), etc.

Forewords for CP4

Selected Testimonials for CP1/2/3

Authors' Profiles

Important News

Friday, 11 June 2021: After 1.5 more years of additional translations by Miguel Revilla Rodriquez (since 01 January 2020), CP4 Book 1 and 2 are now available in Spanish language. Here are the Amazon Book 1 link and Amazon Book 2 link.

Wednesday, 01 January 2020: CP3 (2013 edition with a bit of 2018 upgrade) is now available in Spanish language. If you are a Spanish-speaking programmer, we recommend that you get the Spanish version that has been translated over the past 1+ year by Miguel Revilla Rodriquez (the current admin of (UVa) Online Judge). Here is the Amazon Link, ISBN: 978-1711024813. [Updated remarks on 11 June 2021]: Now that CP4 version is fully available in Spanish, I suggest that you go for the latest version :).

Tuesday, 24 October 2017: CP3 is now available in Korean language. If you are Korean, we recommend that you get the Korean version that has been translated over the past 1+ year by lewha0. Here is the publisher link: Insight Book, Korea.

Buy Now!

Partner Links