|Classic Computer Science Problems in Java|
Author: David Kopec
In this case the code is Java and of course if you aren't a Java programmer this isn't going to be of much use to you. The good news is that at the time of writing there is a Swift and a Python version, which although I haven't read them are presumably much the same as this book only in a different language.
The first thing to say is that some of the "classic" algorithms are very simple and they are even announced as "small problems" in Chapter 1. The first algorithm in the book is the Fibonacci sequence and this is implemented using recursion, which is a bit of a barrier to put at the very start of any book. Even so, as long as you don't lose confidence, it is easy enough. I'm not sure I'd call it a classic algorithm, however it is a very common example. The implementation is also elaborated to include memoization, which either is or isn't part of a classic algorithm depending on your point of view. Memoization is about efficiency and hence isn't really an issue if you are considering theoretical algorithms, but it is a basic technique to make almost anything go faster. I'd rather not see it introduced in this confusing position. After all this sophistication we have a final iterative version - perhaps this would be better presented first? The rest of the chapter details a simple encoding/decoding problem, calculating Pi using the easy, but slow to converge, series and the Towers of Hanoi problem. I don't really think any of these are classic algorithms in the computer science sense, but they are all commonly used as examples.
Chapter 2 is about search, which is a classic problem, but the solutions presented are the usual computer science approach of linear search, binary search and so on wrapped up in a problem involving searching DNA. From here we have depth first and breadth first search and A*.
Chapter 3 is about constraint satisfaction, which is not a mainstream "classical" problem, but we do meet the eight queens problem which is. This is essentially about backtracking search.
Chapter 4 moves on to consider graph algorithms. Here we meet some classic algorithms - Minimum Spanning Tree and Dijkstra's algorithm. Chapter 5 is about genetic algorithms, which I do not think of as classic problems or even classic algorithms, interesting though they are. The same goes for Chapter 6 and the K-means clustering algorithm. As far as I'm concerned K-means is just one a set of possible clustering algorithms.
Chapter 7 continues with a look a neural networks and, for me, nothing could be further from a classic problem. It covers back-propagation and goes fairly deeply into basic neural networks. Chapter 8, called Adversarial Search, it is still more connected to AI than anything else. The examples are tic-tac-toe and Connect Four and the algorithms are mini-max and alpha-beta pruning. Classics of AI indeed.
The final "proper" chapter, Chapter 9, is on the knapsack problem and the travelling salesman problem, with a brief introduction to NP problems. Chapter 10 is an interview with Brian Goetz who is well known in the Java world and, while the interview is interesting, I'm not at all sure why it is included in the book. The focus of the book is using Java to solve some well-known problems rather than Java as a language.
This book might well not be what some portential readers are expecting? I'm not sure that the selection of problems is what a majority of computer scientists would consider "classic". but this is a matter of opinion. There are a lot of AI-oriented algorithms included and this pulls the book's focus away from what many would consider mainstream Computer Science. The biggest ommission are the sorting algorithms, which arguably are the starting point for all accounts of classical computer science algorithms. Also there are no data structure algorithms - linked lists, stacks, trees etc. If you do want to stray from pure computer science then what about the Fast Fourier Transform? All good candidates for a classic problem book.
What all this means is that this book isn't going to be of much use to anyone hoping for some help with a computer science course. Its idea of classic algorithms is too patchy and too biased to be of much help. The introduction to the book does state very clearly that it isn't an academic tome covering big O analysis etc, but even so the choice of algorithms doesn't fit with its title.
Having said this the algorithms are that are described are well presented and it is a slim book and so you can't really expect it to cover everything. So the bottom line is that if the selection of problems interests you, then why not give it a try? What it does do is done well.
|Last Updated ( Wednesday, 01 September 2021 )|