Mastering Algorithms with C
Author: Kyle Loudon
Publisher: O'Reilly & Associates
Price: $34.95 US
Reviewer: John Kacur
While you might not have “mastered” algorithms after reading this book, it is still a well-written book that I recommend without reservations. In the preface, the author explains why his “approach is not what one normally thinks of in connection with books on data structures and algorithms.” He rightly explains that many books on data structures and algorithms have an “academic feel about them, and real details such as implementation and application are left to be resolved elsewhere.” Indeed, the strength of this book is that instead of snippets of code, we are presented with full programs as useful implementations.
The book is divided into three parts. Part I, Preliminaries, is the shortest. The author doesn't try to teach the reader C, but instead provides a useful review of some tricky topics such as the use of pointers (generic pointers, function pointers casts and so on). He touches lightly on recursion and reminds us what tail recursion is and why it is efficient. There is also an overview of O-Notation for analyzing algorithms. Some people might complain that the book doesn't go into enough depth here, but if you view it as a companion text to the more theoretical books from your college courses, then this is just the right amount of information you need to continue on to the implementations.
Part II, Data Structures, is where the book starts to shine. There are chapters on linked lists, stacks and queues, sets, hash tables, trees, heaps and priority queues and graphs. Each chapter is broken down further. For example, the one on linked lists discusses singularly linked lists, doubly linked lists and circular lists. The implementation of linked lists is where we first see the value of Loudon's good software engineering practices. Public interfaces are documented in separate header files, and private functions are static so they remain in file scope.
Because programming styles tend to be personal, some readers are likely to quibble with Loudon's coding conventions. However, since he picked a style and applied it consistently, his code is very clean and readable. For example, all structures have typedefs and names, where the name of the structure is the name in the typedef followed by an underscore. No shortcuts are taken, so unlike many books that demonstrate the principles of a linked list by using a data type of int, Loudon uses a pointer to void for a generic implementation that can use any data type.
Part III is called Algorithms. The chapters here are Sorting and Searching, Numerical Methods, Data Compression, Data Encryption, Graph Algorithms and Geometric Algorithms. While these chapters are not necessarily comprehensive (and how could a one-volume book be comprehensive?), Loudon presents some interesting topics that are not traditionally covered in books on algorithms, such as data compression and data encryption. It was particularly interesting to read about Lempel-Ziv compression, given the recent copyright controversy with GIF graphics.
If you are a beginning programmer, you should first read a book such as The C Programming Language by Kernighan and Ritchie. If you are new to data structures and algorithms, this is an excellent book with real implementations to study. I would recommend it as a companion to the more traditional academic books typically assigned in college courses. If you are an intermediate to expert programmer, you might still appreciate this book as a practical reference that won't bog you down in theoretical detail, yet will allow you to get a program up and running quickly.
John Kacur (firstname.lastname@example.org) has a B.A. in Fine Arts, and a B.Sc. in Computer Science. He recently moved to Toronto, Canada to accept a job with IBM.
|Be Kind, Buffer!||Apr 26, 2017|
|Preparing Data for Machine Learning||Apr 25, 2017|
|openHAB||Apr 24, 2017|
|Omesh Tickoo and Ravi Iyer's Making Sense of Sensors (Apress)||Apr 21, 2017|
|Low Power Wireless: 6LoWPAN, IEEE802.15.4 and the Raspberry Pi||Apr 20, 2017|
|CodeLathe's Tonido Personal Cloud||Apr 19, 2017|
- Preparing Data for Machine Learning
- Be Kind, Buffer!
- Teradici's Cloud Access Platform: "Plug & Play" Cloud for the Enterprise
- The Weather Outside Is Frightful (Or Is It?)
- Simple Server Hardening
- Understanding Firewalld in Multi-Zone Configurations
- Bash Shell Script: Building a Better March Madness Bracket
- Server Technology's HDOT Alt-Phase Switched POPS PDU
- Gordon H. Williams' Making Things Smart (Maker Media, Inc.)