Mastering Algorithms with C and over 2 million other books are available for Amazon Kindle . Learn more

Sign in to turn on 1-Click ordering.
Trade in Yours
For a £2.76 Gift Card
Trade in
More Buying Choices
Have one to sell? Sell yours here
Sorry, this item is not available in
Image not available for
Image not available

Start reading Mastering Algorithms with C on your Kindle in under a minute.

Don't have a Kindle? Get your Kindle here, or download a FREE Kindle Reading App.

Mastering Algorithms with C [Paperback]

Kyle Loudon
3.5 out of 5 stars  See all reviews (4 customer reviews)
RRP: £28.99
Price: £21.07 & FREE Delivery in the UK. Details
You Save: £7.92 (27%)
o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o
Only 1 left in stock (more on the way).
Dispatched from and sold by Amazon. Gift-wrap available.
Want it tomorrow, 23 Sep.? Choose Express delivery at checkout. Details


Amazon Price New from Used from
Kindle Edition £20.02  
Paperback £21.07  
Trade In this Item for up to £2.76
Trade in Mastering Algorithms with C for an Amazon Gift Card of up to £2.76, which you can then spend on millions of items across the site. Trade-in values may vary (terms apply). Learn more

Book Description

15 Aug 1999 1565924533 978-1565924536 1

There are many books on data structures and algorithms, including some with useful libraries of C functions. Mastering Algorithms with C offers you a unique combination of theoretical background and working code. With robust solutions for everyday programming tasks, this book avoids the abstract style of most classic data structures and algorithms texts, but still provides all of the information you need to understand the purpose and use of common programming techniques.

Implementations, as well as interesting, real-world examples of each data structure and algorithm, are included.

Using both a programming style and a writing style that are exceptionally clean, Kyle Loudon shows you how to use such essential data structures as lists, stacks, queues, sets, trees, heaps, priority queues, and graphs. He explains how to use algorithms for sorting, searching, numerical analysis, data compression, data encryption, common graph problems, and computational geometry. And he describes the relative efficiency of all implementations. The compression and encryption chapters not only give you working code for reasonably efficient solutions, they offer explanations of concepts in an approachable manner for people who never have had the time or expertise to study them in depth.

Anyone with a basic understanding of the C language can use this book. In order to provide maintainable and extendible code, an extra level of abstraction (such as pointers to functions) is used in examples where appropriate. Understanding that these techniques may be unfamiliar to some programmers, Loudon explains them clearly in the introductory chapters.

Contents include:

  • Pointers
  • Recursion
  • Analysis of algorithms
  • Data structures (lists, stacks, queues, sets, hash tables, trees, heaps, priority queues, graphs)
  • Sorting and searching
  • Numerical methods
  • Data compression
  • Data encryption
  • Graph algorithms
  • Geometric algorithms

Frequently Bought Together

Mastering Algorithms with C + Understanding and Using C Pointers
Price For Both: £44.06

Buy the selected items together

Customers Who Bought This Item Also Bought

Product details

  • Paperback: 562 pages
  • Publisher: O'Reilly Media; 1 edition (15 Aug 1999)
  • Language: English
  • ISBN-10: 1565924533
  • ISBN-13: 978-1565924536
  • Product Dimensions: 25.4 x 17.8 x 3 cm
  • Average Customer Review: 3.5 out of 5 stars  See all reviews (4 customer reviews)
  • Amazon Bestsellers Rank: 258,289 in Books (See Top 100 in Books)
  • See Complete Table of Contents

More About the Author

Discover books, learn about writers, and more.

Product Description

Amazon Review

Written with the intermediate to advanced C programmer in mind, Mastering Algorithms With C delivers a no-nonsense guide to the most common algorithms needed by real-world developers.

The highlight of the book has to be its concise and readable C functions for all the algorithms presented here, including basics such as linked lists, stacks to trees, graphs and sorting/searching algorithms. The C functions that implement these algorithms are clearly printed and remarkably easy to read. You can use this sample code directly or adapt it into your C/C++ code.

Although mathematical concepts like Big-O notation are discussed, the authors don't get bogged down in the computer science theory surrounding algorithms. Instead, they present the most tried-and-true algorithms available today in an efficient format. Besides introducing each algorithm, they describe how each is used in computing today, along with a short demo application. Some of these samples are quite low-level, such as a virtual memory manager implemented with linked lists. Most examples are more general interest, such as a graphing example that counts network hops.

Each section ends with questions and answers about how the algorithms work, along with references to other algorithms (both in the book and from other sources). The authors concentrate on the most useful algorithms available today and don't try to cover every available variation. Busy readers will appreciate the intelligent selection--and efficient presentation--used here.

There are a number of books on C algorithms, but Master Algorithms With C is one of the most concise and immediately useful. It's a perfect choice for the working C/C++ programmer who's in a hurry to find just the right algorithm for writing real-world code. --Richard Dragan

Topics covered: Algorithm efficiency, pointer basics, arrays, recursion, Big-O Notation, linked lists, stacks, queues, sets, hash tables, trees and B-trees, searching, heaps and priority queues, graphs, sorting and searching algorithms, numerical methods, data compression, Huffman coding, LZ77, data encryption, DES, RSA, graph algorithms, minimum spanning trees, geometric algorithms, convex hulls.


'This is an O'Reilly book, surely one of the best publishers of technical books areound. I love 'em, from the animal cover to the Colophon, and it is rare indeed that I come across an O'Reilly book that I regret buying....So, all in all, an enjoyable book and one I will move onto my Important Algorithm Book shelf, rather than on the floor in a pile with the also-rans. Recommended.' - Julian M Bucknall Developers Review, August 2000

Inside This Book (Learn More)
Browse Sample Pages
Front Cover | Copyright | Table of Contents | Excerpt | Index | Back Cover
Search inside this book:

What Other Items Do Customers Buy After Viewing This Item?

Customer Reviews

3.5 out of 5 stars
3.5 out of 5 stars
Most Helpful Customer Reviews
6 of 6 people found the following review helpful
4.0 out of 5 stars Covers the basic algorithms very well 22 Dec 2003
This book offers a solid introduction to algorithms in the C programming language. All the key topics are covered, and the example code is well written. My only criticism would be the block commenting style the author uses, but the proportional font used makes them less distracting than they might have been. If this book whets the appetite, then Sedgewicks "Algorithms in C" offers a more in depth follow up.
I must comment on one of the other reader reviews, which has been cribbed from a similar review on the website of O'Reilly, this books publishers. Anyone who doesn't know the fundamental problems with numeric accuracy on computers should not be at a stage where they need to know algorithms in C. Any good computing course should cover the fundamentals of how numbers are stored, stressing the lack of precision and the possibility of overflow, before any in depth programming is taught.
Comment | 
Was this review helpful to you?
2 of 2 people found the following review helpful
4.0 out of 5 stars A very O'Reilly book. 6 Oct 2012
By notjim
Format:Paperback|Verified Purchase
"[O'Reilly] where the first publisher I contacted, and the one I most wanted to work with because of their tradition of books covering 'just the facts'" - from the Preface.

This book covers just the facts, in 500 pages it gives a grand tour of algorithms and data structures and that 500 pages includes extensive pieces of code, it manages this by sticking to short, pithy descriptions and being unafraid to stop the description when the algorithm is described. This seems almost a mania, for example, we are told that algorithms that divide the data in two again and again incur a cost of log n, but the three or four lines it would take to prove this are skipped, we are told a couple of times that a factor of n(n+1)/2 is the result of the "well known formula" for adding the numbers 1 to n, it would've seemed easy to give the formula. The result though is a very useful and precise book you could go to in a hurry and remind yourself how radix sort works, or formalize your hazy knowledge of data structures.

For very slow and careful study the code listing would be invaluable but it seems a waste not to have include more commentary on the code, commentary as opposed to comments, the code itself is commented like real code in a way that is wasteful of space without being pleasant to read. The author writes so well but the code is left most to stand for itself, to understand it you have to read it line by line and work it out. In this way, the book aims itself at a painstaking study or as a source of quick reference, but is unsuitable for a middle course of directed reading, where code commentary is essential.

A rose is a rose is rose: the author wanted to write an O'Reilly book, this is what it is and if that's what you want, this book is for you.
Comment | 
Was this review helpful to you?
6 of 8 people found the following review helpful
5.0 out of 5 stars A fantastic introduction to some advanced C. 28 Mar 2001
By A Customer
This book is fantastic. It covers a wide range of topics including sorting, data compression, trees and encryption. It also covers complexity notation and the basic maths behind various aspects.
I would recommend it to anyone.
Comment | 
Was this review helpful to you?
9 of 32 people found the following review helpful
By A Customer
I'm just going to comment on one chapter of the book: "Numerical Methods", the thirteenth.
Incredibly, Loudon presents a chapter on numerical methods without any discussion of the effects of the limitations imposed by the finite representation of numbers in C. No mention is made of the problems that occur when one tries to represent extremely large numbers or extemely small numbers (close to 0) in C, yet these are common situations when line gradients approach vertical or horizontal. Loudon presents C as though it was capable of representing numbers, when of course C is only capable of a very limited approximation to numbers.
Novices who enter the field of numerical methods without having been warned about the problem are going to risk producing very inaccurate results (and one presumes that some of the readers of this book may simply take the implementations of algorithmspresented and apply them to the field they work in, be it analysis of biological experiment results, or investment performance analysis.)
The best Loudon does is to mention "Error Approximation" in the "Related Topics" section at the end of the chapter -- but please note, Loudon is referring to the problems of approximation in the algorithm itself, not the additional problems caused by implementing the algorithm in C where numbers are not represented exactly.
In summary, the problem here is that Loudon has written a useful chapter about some algorithms used in numerical methods, yet has completely failed to deal with the consequences of the implementation of those algorithms in C (surely the point of such a book as this?)...This part of the book is, in my opinion, extremely dangerous to the user, and must be corrected in the next edition.
Was this review helpful to you?
Most Helpful Customer Reviews on (beta) 3.8 out of 5 stars  21 reviews
35 of 37 people found the following review helpful
5.0 out of 5 stars Exceptional writing, elegant code, great examples 13 Sep 1999
By A Customer - Published on
Mastering Algorithms in C is the most readable algorithms book I've ever encountered. Not only does the author have a tremendous command of English, he has a writing style that is simply a pleasure to read. The author also deserves mention as having one of the cleanest coding styles I've come across. Having taught and worked with computers for over 15 years, I've seen many. It is no easy feat to present the subject of algorithms using real C code in a consistently elegant manner. This book does it wonderfully. Another feature of the book that works exceptionally well is its detailed presentation of interesting (and I emphasize interesting) real-world examples of how various data structures and algorithms in the book are actually applied. I'm a computer science type, so I especially enjoyed the examples about virtual memory managers, lexical analyzers, and packet-switching over the Internet. But the book includes many other examples of more general interest. Students will find all of the examples particularly insightful. Although most of the code in the book does make use of many of the more advanced features of C, an inordinate number of comments have been included which should help even the feeblest of programmer carry on. In addition, there are two great chapters on pointers and recursion. Exceptional writing, elegant code, great examples, not to mention a lot of entertainment value -- O'Reilly has another winner here. I highly recommend it.
47 of 53 people found the following review helpful
4.0 out of 5 stars Helpful book on algorithms using C 2 Mar 2001
By Dr. Lee D. Carlson - Published on
C programming is still with us because of its high performance ability and this book outlines several algorithms using the language. It begins with a classification of algorithms as randomized, divide-and-conquer, dynamic programming, greedy and approximation. Some algorithms the author states defy classiification but he does not give examples. Pointers are discussed in the next chapter, and covers how to avoid dangling pointers, memory allocation, pointers to data structures, function parameters, double pointers, and generic and function pointers. The chapter is clearly written and diagrams are used frequently to illustrate the uses and properties of pointers. The author in particular gives an excellent explanation of how C can simulate call-by-reference parameter passing. This capability in C can be a source of trouble to the newcomer to C. The author does not however discuss triple pointers in this chapter, in spite of their great utility in computational geometry and computational radiology. Void pointers and casting are discussed in detail though, and the author does a good job. Only a cursory discussion of function pointers is given; I would have preferred many more examples to be given. Recursion and tail-recursion are discussed in Chapter 3, with the factorial function used to illustrate the differences. Computational complexity and the O-notation are covered in the next chapter, with the treatment pretty sparse but clear. Linked lists, extremely useful in all areas of engineering and science, are discussed effectively in Chapter 5. Eleven linked list macross, thirteen doubly linked list macros, and eight circular list macros are discussed and the complexity of each given. Virtual memory and paging are given as examples of applications of linked lists. The author moves on to stacks in the next chapter with several stack macros outlined. FIFO queues are discussed but in view of their importance in network modeling not enough examples are given. A very interesting overview of how to implement sets as a data type in C is given in Chapter 7. I was not aware that such a construction could be done effectively in C so this chapter was of particular interest to me. All of the usual set operations are implemented using a number of diffrent macros. A clever set covering algorithm is given at the end of the chapter. Hashing and chain hash tables as arrays of linked lists are outlined in the next chapter. Hash functions are used heavily in such areas as cryptography and the author does a fine job of outlining their implementation. After a good discussion of trees, heaps, priority queues, and graphs, the author begins in the third part of the book with the actual implementationof many useful algorithms. The chapter on numerical methods could be more in depth because of its immmense importance and because C has been one of the best performers for the the time intensive calculations in this area. Huffman encoding and other compression algorithms are also treated with some detail. Several macros for bit operations are given and the ones discussed are helpful for the next chapter on encryption algorithms. The DES and RSA algorithms are treated in this chapter, but unfortunately elliptic curve encryption algorithms are not. The book ends with a fairly good overview of graph algorithms and algorithms in computatational geometry. This is really a pretty good book and gives a good overview of some very important algorithms, and all within a little over 500 pages. The only major omission was the lack of exercises/problems at the end of each chapter.
32 of 36 people found the following review helpful
5.0 out of 5 stars Fantastic addition to any personal libriuary. 9 Mar 2000
By B. S. Clewett - Published on
Just what I needed. One of those books I had to ring in sick to work, sit at home and read.
Writing commercial c applications for the Internet, I was looking for a book to give me assistence with my coding. What I found was something which caused me to go back and rewrite a lot of my work!
Starting by explaining exactly how memory is managed when calling fuctions, going on to explain, in english, how many commonly used stuctures in c work. Everything from hash tables to encryption. A good read for anybody interested in how code works. Essential for anybody wishing to write quality programs.
The best bit. This comes with c libruaries uncompiled with examples, fully explained in the text. Many of which I have used. Reliable, easy to implement and dramatically increase the quality of my code. Want a easy to use binary search tree? A few minutes work and it's there.
I also emaild the author, who was more than happy to help with a question.
Personally speaking, one of the best computer books I have ever bought.
18 of 21 people found the following review helpful
5.0 out of 5 stars Stuff I have never seen before! 12 Jan 2000
By SciFi Fan - Published on
I have read a half-dozen or more books pertaining to C Algorithms, and most of them were the same. This touched on the usual stuff - sorting, hashing, linked lists, etc. But it touched on these subjects in ways that are so general purpose that the sample code can be used with little modification! It also adds a couple of new things such as Set algorithms and an explaination of how to pass functions as paramenters to functions.
There could have been a few more examples, and he could have explained some of his material in plain english, instead of engineerese.
Overall the book is excellent, and I will refer to it often.
52 of 67 people found the following review helpful
2.0 out of 5 stars A small collection of over-commented code 5 Jun 2000
By Cris Luengo - Published on
I hoped to find a broad overview of existing algorithms. Instead I got a small collection of over-commented code. It is true that this book contains some algorithms not discussed in similar books, but it also doesn't contain many algorithms that I consider a part of a programmer's standard toolbox. For example, there is no mention of string matching and searching. The author discusses an implementation of the LZ77 compression algorithm, but doesn't even give a hint as to the workings of related (better) algorithms. There is an implementation of the RSA public key encription, but no mention on how the private encription/public decription counterpart works. The discussion on hash tables only covers hash tables with linked lists, and not the easier to implement double hashing. And I could go on and on.
But the most annoying thing about the book is the author's commenting style, which render the code itself unreadable. Almost every instruction is commented by a 5-line high, 80-column wide comment block, exactly in the way that Rob Pike makes fun of in his "Notes on Programming in C" article, where he says: "Don't laugh now, wait until you see it in real life."
In short, I would only recommend this book to people wanting to learn some basic algorithms, but already have a strong sense of correct programming style.
Were these reviews helpful?   Let us know
Search Customer Reviews
Only search this product's reviews

Customer Discussions

This product's forum
Discussion Replies Latest Post
No discussions yet

Ask questions, Share opinions, Gain insight
Start a new discussion
First post:
Prompts for sign-in

Search Customer Discussions
Search all Amazon discussions

Look for similar items by category