Classic Computer Science Problems

Essential Techniques for Practicing Programmers

A Book Series by David Kopec


Classic Computer Science Problems is a series of books that helps software developers learn several problem solving techniques from the realm of computer science. The series spans three programming languages and nine human languages. The books are written in a tutorial-like, code-centric format. They are appropriate for experienced software developers who want to refresh their skillset, and intermediate programmers who are looking to take their skills to the next level. They can also be helpful when learning some of the more advanced aspects of the programming languages covered by the series.

The three books in the series are Classic Computer Science Problems in Java, Classic Computer Science Problems in Python, and Classic Computer Science Problems in Swift. They are published by Manning. Reading each book does not require a CS degree. In fact, self-taught programmers will get a useful survey of computer science topics they missed by not having a CS education. The books are broad, not deep. Each topic is covered by going over some classic problems, typically taught in a CS undergraduate curriculum, and their solutions in the book's respective language.

These are not textbooks. They are not heavy on mathematical notation, nor do they claim to be replacements for a class in data structures and algorithms. Instead, they aim to excite developers and students about engaging computer science topics by presenting them succinctly with working code in the language of the reader's choice.


The computer science topics touched on through the problems are wide ranging and include:

The Books

Classic Computer Science Problems in Java

  • Requires Java 11+
  • Published in December, 2020
  • Available in English in print from Manning, Amazon, and other fine book sellers.
  • Available in English in PDF, .mobi (Kindle), and .epub (Apple Books & Other E-readers) from Manning
  • Published in German by Rheinwerk Computing and available from Amazon Germany

Classic Computer Science Problems in Python

  • Requires Python 3.7+
  • Published in March, 2019
  • Every code example uses type hints
  • Available in English in print from Manning, Amazon, and other fine book sellers.
  • Available in English in PDF, .mobi (Kindle), and .epub (Apple Books & Other E-readers) from Manning.
  • Published in Japanese by O'Reilly Japan and available from Amazon Japan.
  • Published in Portuguese by Novatec Editora and available from Amazon Brazil.
  • Published in Russian by Piter
  • Published in German by Rheinwerk Computing and available from Amazon Germany
  • Published in Polish by Wydawnictwo Naukowe PWN
  • Published in Korean by Hanbit Media
  • Published in Simplified Chinese by Posts & Telecom Press
  • Published in Traditional Chinese by GOTOP.

Classic Computer Science Problems in Swift

  • Written against Swift 4.1 (Xcode 9), all examples compile in Swift 4.2 (Xcode 10)
  • Published in April, 2018
  • Available in English in print from Manning, Amazon, and other fine book sellers.
  • Available in English in PDF, .mobi (Kindle), and .epub (Apple Books & Other E-readers) from Manning.
  • Available in Simplified Chinese from Amazon China.

The Code

The source code from all of the books is freely available under the terms of the Apache License. This effectively means you can reuse the code in any project you work on, whether personal or commercial, as long as you credit me/the book in an acknowledgement. You can find repositories on GitHub containing the source code for the Java book, the Python book, and the Swift book.

The code has been ported by readers (and in the case of PHP and JavaScript, the German translator) to C++, Go, PHP, JavaScript, Ruby, and Rust. So, in total, the source code is available in 8 programming languages. Please let me know if you port the book to another language. I would love to link to that here.


The series has been fortunate to receive great reviews from official reviewers and readers alike.

Praise for Classic Computer Science Problems in Python

“David is an excellent programmer and teacher and you should buy his book if you have ANY interest in algorithms period. The great thing about Python is that you’ll understand pretty much everything that’s going on even if you’re a newbie.”
—Dan Loewenherz
Source: Twitter
“I absolutely love Classic Computer Science Problems in Python. It taught me both how to use Python in ways I never had before and about some computer science concepts that I may have heard of but had never used for actual coding projects... This is the only computer science book I’ve read cover-to-cover in probably ten years.”
—S. Nicholson
Source: Amazon
“If you want a Python book that will stretch your brain not its title, look at Classic Computer Science Problems in Python by @davekopec. You may not find it immediately applicable to SEO or IR but it will make you a better coder and problem solver, it has for me.”
—Daniel Morell
Source: Twitter
“Computer Science degree condensed into a thin book”
—Pisarenco Alexandru
Source: Amazon Germany
“I have been working on improving my Computer Science knowledge, it has grown over the years, and I know that improving it will help my imposter syndrome. With that said, I have been spending my time reading Classic Computer Science Problems in Python, this is a fantastic book, and I am confirming what I do know and learning all kinds of new information.”
—Jamie Phillips
Source: Jamie's Blog
“This slim volume is worth every cent and enormously timely with Python being the new hotness in first language folks are adopting: fill in those gaps you missed by learning from Stack Overflow!”
—Scott Ranvel
Source: Twitter
“One sign of how much I liked this book is that I keep recommending it to colleagues – so far two of them have ordered it for themselves. The main reasons I like it are the breadth of algorithms covered, the complete (yet small) solutions that are easy to explore on your own, and the interesting examples used when demonstrating the algorithms.”
—Henrik Wayne
Source: Henrik's Blog
“I found the book to be well-written and well-explained. The examples were clear and helped reinforce the concepts that were being explored. Each chapter introduces a concept and then provides examples of how that concept can be applied to solve problems that are probably familiar to many readers.”
—Gary Barnhart
Source: Official Manning Reviewer
“The book is great for intermediate-level Python programmers who lack formal training in computer science. Although it does not delve into the rigorous mathematical aspects of CS, it provides sufficient explanations of various CS topics and backs them up with real-world examples of their application.”
—Edmond Sesay
Source: Official Manning Reviewer
“A thoroughly entertaining way of exploring basic algorithms in Python that can easily lead to solutions of very complex problems. The author has a very easy writing style without becoming too familiar. The level of explanations was just about right for me to follow without missing any important details.”
—Juan Jimenez
Source: Official Manning Reviewer

Praise for Classic Computer Science Problems in Swift

“...As a self taught programmer without formal education I got a deeper understanding and refresher on some of the most classic computer science problems while at the same time getting to know Swift. Conclusion: time well spent!”
—Samuel Bosch
Source: Amazon Germany
“This is a very excellent book for people who want to learn about some classic algorithms using the Swift Programming Language. I'm still a Swift beginner but this book helped me to learn how to solve some of the most interesting problems using the language. The chapters I enjoyed most are the Constraint Satisfaction and Genetic Algorithms since these were concepts I always heard about but didn't really understand them. Recommended if you want to boost your algorithmic skills, refresh your mind about concepts you learned in your CS classes and even for coding interviews.”
—Godfred Asamoah
Source: Amazon UK
“An extraordinary Swift language book and a contribution to the practice of Swift algorithmic problem solving.”
—Eric Giannini, Nexmo
Source: Official Manning Reviewer
“A fun read to sharpen your classic programming skills and to bring your Swift programming to another level.”
—Becky Huett, Big Shovel Labs
Source: Official Manning Reviewer
“An excellent book for all Swift programmers, and for students learning algorithms.”
—Julien Pohie, Dell
Source: Official Manning Reviewer
“A hands-on and informative exploration of computer science problems.”
—Chad Johnston, Polaris Alpha
Source: Official Manning Reviewer
“...the first CS book I've read cover to cover... great job @davekopec!”
—André Veiga
Source: Twitter
“Classic Computer Science Problems seems to understand the psychological quirks of software developers and how to use them as a motivational tool.”
—Mitch Chapman
Source: Blog

Interviews with David

Talk Python to Me (May, 2019)

#211 Classic CS problems in Python

Podcast.__init__ (February, 2019)

Classic Computer Science For Pythonistas - Episode 197

Free Content

Classic Computer Science Problems in Python

Classic Computer Science Problems in Swift

Open Source Projects Related to the Books

The Swift book was based on several (fairly small) open source projects that I had worked on prior to writing it.

Questions (and Answers)

Are these books suitable for beginning programmers?

Not really: The books in the series assume at least intermediate knowledge of the programming language they are written against. For example, you should be at least an intermediate Python programmer before picking up Classic Computer Science Problems in Python. You do not need to have taken a data structures and algorithms class, though. No data structures and algorithms knowledge is assumed, but programming knowledge is.

Are the books a good way to learn the programming languages that they cover?

Generally, no, but for some readers, yes. I have heard some readers have used them that way, but I think this will only work for programmers who are very experienced in another language prior to picking up the book. There is no "beginners" content about how to use each of the languages in the books. That said, if you are already an intermediate programmer in the given language, reading the book will help you learn some of the language's more advanced constructs. For example, if you have some basic knowledge of Swift and a strong programming background, you will better understand protocol-oriented programming and Swift enums after reading Classic Computer Science Problems in Swift.

Why isn't sorting or some other classic data structures and algorithms topic covered in the series?

These books are not data structures and algorithms textbooks. They don't claim to be that, and they are geared for a slightly different audience. These are broad survey books that cover a large variety of computer science topics in a succinct, friendly, tutorial-like fashion, heavy with a lot of real code. In other words, they are not meant to be academically rigorous, but instead fun while still being educational. Frankly, some of the cliche topics, like sorting, are left out because they will bore many of the self-taught programmers who will pickup the books. The breadth of topics covered in the series actually stretches beyond the gamut of most data structures and algorithms textbooks by covering several topics from artificial intelligence. About half of each book's content can be considered AI. On the other hand, yes, several traditional data structures and algorithms topics are left out.

Will a book in the series in another programming language come out?

It's not likely to happen in the near-term. I think three programming languages is enough for a while. We did three languages in three years (Swift 2018, Python 2019, Java 2020). In the future, depending on the success of the Java book and the publisher's interest, I am open to working with a co-author on a "port" of the book to a language that I am less familiar with. Go is one language the publisher and I have discussed. We've also discussed Rust, Kotlin, JavaScript, C#, and more. However, beyond Java, these books would be looking at release dates of 2022 or later if they happen. If you look at the Code section above though, you can find ports of the books' code to many other programming languages.

Will a book in the series be translated into another human language?

Yes, Classic Computer Science Problems in Python has been translated into Japanese, Polish, Portuguese, German, Russian, Korean, Simplified Chinese, and Traditional Chinese. Classic Computer Science Problems in Swift is available in Simplified Chinese. Classic Computer Science Problems in Java is available in German. If you are interested in acquiring the rights to translate one of the books into another language, please contact me and I will put you in touch with the appropriate person at the publisher.

How much do the books cost?

The MSRP of the English print editions ranges from $39.99 to $49.99. However, you can often find them cheaper than that from third-party booksellers. Every English print edition copy comes with a way to download the eBook for free from Manning's website. The standalone DRM-free eBooks are available for less from Manning directly. As a bonus for reading this far, here is a promo code: ccspkopec should get you 40% off on for any of the books (links to Manning's website are above). Please let me know if the promo code does not work for you.

I know of a classic problem you didn't include in the book.

Please let me know about it if you think it's just esoteric enough that I haven't heard of it, but it's still fairly classic.

What references did you use when writing the book?

As you can see from footnotes and the More Resources appendix, the two books I relied most heavily upon as references are Algorithms by Sedgewick and Wayne and Artificial Intelligence: A Modern Approach by Russell and Norvig. I also relied on Introduction to Algorithms by Cormen, Leiserson, Rivest, and Stein, The Algorithm Design Manual by Skiena, and Artificial Intelligence in the 21st Century by my late father, Danny Kopec, and Lucci, as further references. I was fortunate to see most of the classic computer science problems in the books during my education at Dartmouth, so I must extend a thank you to the faculty there, especially Tom Cormen and Devin Balkcom. Since, once again (see the earlier question on why certain data structure and algorithms topics are not in the series), these books are not textbooks, if you want a more academically rigorous introduction to the topics covered, I recommend the above mentioned textbooks.

What is the background of the author?

I am an associate professor of Computer Science and Innovation at Champlain College, a small teaching college in Burlington, Vermont, USA. I have worked professionally as a software developer and I am an active contributor to open source projects. I am also the author of Dart for Absolute Beginners (Apress, 2014) but I no longer recommend that book since it is now significantly out-of-date. I hold a bachelor's degree in economics from Dartmouth College and a master's degree in computer science, also from Dartmouth. I live in Burlington with my wife, Rebecca, and my kids. I co-host a podcast about business books and a podcast explaining software for laypeople.

Contact Me

I always love to hear from readers. Please send me your questions or comments on X or by email.


If you'd like to get notified about my future books and other projects through a very low volume newsletter, please subscribe below.