hello.pbaumgarten.com

Book: Classic Computer Science problems in Python

computer-science
python

#1

So I heard about this book after listening to an interview with the author, David Kopec, on a Python podcast and immediately thought it would be a worth while investment for my teaching, and a book that I’d be recommending to several students. I like that it is very practical in nature without getting stuck in the weeds too much. The printed version of the book only comes out in March, but I bought the early access pass to get a PDF and have printed a copy you are welcome to browse through to see if you’d like to buy your own copy.

Chapter 1 and 2 are focused on some topics that will be very familiar to my DP students such as recursion and search, though it also gets into path searching algorithms such as A* which is nice. From there it gets into Constraint Satisfaction Problems (chapter 3), Graph problems (chapter 4), Genetics (chapter 5), and K-means clustering (chapter 6). What do all these words mean? You’ll have to read to find out, they are all good nerdy fun and classics you’d encounter if you pursue a degree in CS.

What I really like is the accessible approach he took to neural networks in chapter 7. David shows you how to build your own neural network without the libraries while also avoiding the really common trap that a lot of online tutorials seem to fall into where they falsely equate “doing it in only a few lines = making it easy”. If you search for how to make your own neural network online, you’ll find lots of derivations of Andrew Trask’s Neural Network in 11 lines. The problem with this is that those 11 lines have some very complex things going on, and unless you are an absolute master with the Numpy library they are just going to be too complex for beginner programmers to grasp. Instead, over 26 pages David introduces the basic ideas of neural networks, the math involved, and shows you how to do it without the Numpy library. Obviously, given the complexity of the ideas, you do still have to be quite confident with your programming basics including classes and array structures, but it is the most approachable introduction I’ve seen in a while.

Chapter 8 gets into adversarial search for creating an AI opponent for 2 player games such as chess which is also good fun!

All the concepts are explained with practical problems and easy to follow code. If you are genuinely thinking about Computer Science as your field, I’d recommend this book! You can pre-order from the publisher or from Amazon.