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 (email@example.com) 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.
Fast/Flexible Linux OS Recovery
On Demand Now
In this live one-hour webinar, learn how to enhance your existing backup strategies for complete disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible full-system recovery solution for UNIX and Linux systems.
Join Linux Journal's Shawn Powers and David Huffman, President/CEO, Storix, Inc.
Free to Linux Journal readers.Register Now!
- Download "Linux Management with Red Hat Satellite: Measuring Business Impact and ROI"
- 2005 Linux Journal Readers' Choice Awards
- Kbuild: the Linux Kernel Build System
- Linux Mint 18
- Sony Settles in Linux Battle
- Introduction to Named Pipes
- Experimenting with New Methods in Voice over IP
- Advanced Packet Data Testing with Linux
- Overcoming Asymmetric Routing on Multi-Homed Servers
- Supercat Text Colorizer
With all the industry talk about the benefits of Linux on Power and all the performance advantages offered by its open architecture, you may be considering a move in that direction. If you are thinking about analytics, big data and cloud computing, you would be right to evaluate Power. The idea of using commodity x86 hardware and replacing it every three years is an outdated cost model. It doesn’t consider the total cost of ownership, and it doesn’t consider the advantage of real processing power, high-availability and multithreading like a demon.
This ebook takes a look at some of the practical applications of the Linux on Power platform and ways you might bring all the performance power of this open architecture to bear for your organization. There are no smoke and mirrors here—just hard, cold, empirical evidence provided by independent sources. I also consider some innovative ways Linux on Power will be used in the future.Get the Guide