Mastering Algorithms with C

July 1st, 2000 by John Kacur in

While you might not have “mastered” algorithms after reading this book, it is still a well-written book that I recommend without reservations.
Your rating: None
  • Author: Kyle Loudon

  • Publisher: O'Reilly & Associates

  • E-mail: info@ora.com

  • Price: $34.95 US

  • ISBN: 1-56592-453-3

  • 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.

Conclusion

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 (jkacur@acm.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.

__________________________


Special Magazine Offer -- Free Gift with Subscription
Receive a free digital copy of Linux Journal's System Administration Special Edition as well as instant online access to current and past issues. CLICK HERE for offer

Linux Journal: delivering readers the advice and inspiration they need to get the most out of their Linux systems since 1994.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
 mp3 download Beyond the Invisible's picture

linux

On October 2nd, 2007 mp3 download Beyond the Invisible (not verified) says:

the download Why does have page? Wine version a on Windows . Best regards.

Post new comment

Please note that comments may not appear immediately, so there is no need to repost your comment.
The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <pre> <ul> <ol> <li> <dl> <dt> <dd> <i> <b>
  • Lines and paragraphs break automatically.

More information about formatting options

Newsletter

Each week Linux Journal editors will tell you what's hot in the world of Linux. You will receive late breaking news, technical tips and tricks, and links to in-depth stories featured on www.linuxjournal.com.
Sign up for our Email Newsletter

Featured Videos

Setting up an https server in Apache is easy. This tutorial covers how to create and sign your ssl certificate as well as how to configure the web server.

From the Magazine

January 2009, #177

It's a battle as old as time: good vs. evil. Fortunately, Linux and FOSS are on our side as we wage the battle against those who try to steal our secrets and invade our systems.

Checking your system's security is best done sooner rather than later. Test the locks with our article on security verification; find out how to use PAM to help secure your systems; use MinorFS and AppArmor to implement discretionary access control; learn more about Samba security in part III of our series; use Darknet to help detect bots and secure your systems; use the Yubikey to increase your site's security; and don't forget to lock the doors, because a cold boot attack could render your security useless if somebody has physical access to your computer.

But, we're not just about sowing the seeds of fear. We also show you how to use memcached in Rails, how to manage multiple servers efficiently, how to deploy applications easily with Capistrano, how to manage your videos with MythVideo, how to mix it up a bit (your audio that is), and even play a few games.

Read this issue