Classic Computer Science Problems

Essential Techniques for Practicing Programmers

A Book Series by David Kopec

Overview

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 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 two books in the series so far are Classic Computer Science Problems in Python and Classic Computer Science Problems in Swift. Both 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.

Contents

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

The Books

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.
  • Korean, Traditional Chinese, Portuguese, and Polish versions are in the works.

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 both 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 Python book and the Swift book.

One intrepid reader has even ported the first five chapters of the book to C++. Please let me know if you port the book to another language. I would love to link to that here.

Buzz

Both books in the series have 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
“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
“One accomplishment that the writer really brings off, and which is nontrivial, is that he is able to use an approachable tone without being patronizing or using distracting attempts at humor. The writing is really clear. This is a good example of superb didactic technical writing.”
—Daniel Kenney-Jung
Source: Official Manning Reviewer
“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?

Yes, we are working on Classic Computer Science Problems in Java. It will likely have a late 2020 release. It is very possible there will be further books in the series beyond that. 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 2021 or later.

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

Yes, Classic Computer Scinece Problems in Swift is now available in Simplified Chinese. Classic Computer Science Problems in Python has been published in Japanese by O'Reilly Japan. The rights to translate Classic Computer Scinece Problems in Python into Korean, Traditional Chinese, Portuguese, and Polish have been acquired, so editions in those languages should be coming out in the future. If you are interested in acquring 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 print editions is $39.99. However, you can often find it cheaper than that from third-party booksellers. Every print edition copy comes with a way to download the eBook for free from Manning's website. The standalone DRM-free eBooks are $31.99 from Manning. However, as a bonus for reading this far, here is a promo code: ccspkopec should get you 40% off on Manning.com for either book (links to both on Manning's website 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 assistant professor of Computer Science and Innovation at Champlain College. 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 minored in English during undergrad and I think it helped me write these books :-). I live in Burlington, Vermont (in the United States) with my wife, Rebecca, and my dog, Hallie. Here's Hallie studying algorithms while I wrote the first book in the series:

Contact Me

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