Algorithmic Thinking, 2nd Ed (No Starch Press)

Author: Dr. Daniel Zingaro
Publisher: No Starch
Date: January 2024
Pages: 480
ISBN: 978-1718503229
Print: 1718503229
Kindle: B0BZGZHK3B
Audience: C programmers
Rating: 4
Reviewer: Mike James
What exactly is algorithmic thinking?

There is a view that algorithmic thinking is about bringing a programming style of thought to more general problems. You will find courses and books that are more like self help books than programming books. This is not to lessen their importance - the world would be a better place if the majority of people engaged in algorithmic thought rather than the vague waffley stuff that seems to dominate. This book, however, isn't about algorithmic thought. It is much more about the material that you would find in a book called Data Structures with a side order of Algorithms.

Banner

This isn't, however, a standard academic account of data structures. For one thing it uses C - one of my favourite languages. The motivation for this is that C is so primitive you have to do everything yourself and so you cannot avoid the complexitites. If you program in Python then you already have a hash table in the form of a dictionary. Why would you bother implementing something you already have? But in C you don't have such a thing. I tend to agree, but there is a downside to selecting C and again it is the consequence of it being a low-level language. The problem is that expressing algorithms in C can be overlong and peppered with details that are specific to C. For example, in the first chapter Zingaro explains why in C static local variables are different from local variables or auto variables because they are only initialized once when the function is first called. I'm not at all sure why this particular C-ism has been picked out because I could add a lot of similar ones that could well trip you up if C isn't your language of choice. 

The first data structure we meet is the hash table and it is, like all of the other data structures in the book, introduced by means of a problem hosted by a programming judge. These are websites set up so that you can test yourself by solving problems and uploading the solutions. The problems are selected to be relevant to the data structure under consideration, but this means that you might have to sign up to multiple programming-judge sites.

I think that the sucess of this book for the reader depends very much on how well the reader responds to fairly complicated problems and their solutions. If you are of the 100% practical type and don't like abstract explanations because you cannot see how to apply them practically, then you will like this approach. On the other hand an abstract approach can be shorter - I can tell you what a hash table is in a paragraph - and you could well miss the abstract idea hidden by the detail. For example, the idea of a hash table is only defined after ten pages of problem solving. For me having three detailed examples of using hash tables didn't really help - but then I know how a hash table works.

Chapter 2 is about trees and recursion and this is very early in a book on data structures to get into such a complex structure. The exact topic is binary trees and we have two problems that need their solution. 

Chapters 3 and 4 are on memoization and dynamic programming - not topics generally included in a book on algorithms and data structures. This uses recursion again and presents five new problems.

Chapters 5 generalizes the idea of trees to graphs and how to implement a breadth first search BFS. Chapter 6 is about finding the shortest path in a weighted graph and, of course, covers Dijkstra's algorithm and extends it to the case of negative weights.

Chapter 7 is about binary search, but for such a simple algorithm the approach makes it seem complicated in my opinion. The same goes for Chapter 8 and its approach to heaps and segment trees. Chapter 9 is about the union-find data structure which I have to admit I wasn't familiar with on first name terms and after reading the chapter I wasn't sure I knew it any better.

The final chapter is about randomization which is something I do know a little about. I was surprised to find Quicksort as its final topic - Quicksort is not a randomization algorithm at its heart and it really is only relevant in the analysis of its average runtime.

This is a good book if you like solving problems that are more like contrived puzzles than real world problems. The effort seems to be more about solving them than learning about data structures or algorithms. This is not a "let's look at the principles and now let's apply them" sort of book it is more a "let's get solving and see what emerges". You also don't want to read this book if all you are after is a way to catch up with a traditional data structures and algorithms course. This is a book that requires much more dedication if you are going to get anything at all out of it.

If you are prepared to work at the problems and enjoy doing so then this is a very good book. 

  • Mike James is Chief Editor of I Programmer and the author of several programming books in the I Programmer Library. His  recently published Deep C Dives: Adventures in C looks in depth at specific aspects of C that make it a unique language..  

 

To keep up with our coverage of books for programmers, follow @bookwatchiprog on Twitter or subscribe to I Programmer's Books RSS feed for each day's new addition to Book Watch and for new reviews.

Banner


Classic Computer Science Problems in Java

Author: David Kopec
Publisher: Manning
Date: January 2021
Pages: 264
ISBN: 978-1617297601
Print: 1617297607
Audience: Java developers
Rating: 4
Reviewer: Mike James
Getting someone else to do the hard work of converting classic problems to code seems like a good idea. It all depends which problems [ ... ]



Coding All-In-One For Dummies

Author: Chris Minnick
Publisher: For Dummies
Pages: 912
ISBN: 978-1119889564
Print: 1119889561
Kindle: B0B5BBNW9L
Audience: People wanting to learn to code in JavaScript, Flutter and Python
Rating: 3.5
Reviewer: Kay Ewbank

This book is described as offering an ideal starting place for learning th [ ... ]


More Reviews

<ASIN:1871962889>

 

 

 

Last Updated ( Thursday, 19 September 2024 )