Mastering Algorithms With C - Kyle Loudon [2]
All code has been fully tested on four platforms
The platforms used for testing were HP-UX 10.20, SunOs 5.6, Red Hat Linux 5.1, and DOS/Windows NT/95/98. See the readme file on the accompanying website http://examples.oreilly.com/masteralgoc/) for additional information.
Headers document all public interfaces
Every implementation includes a header that documents the public interface. Most headers are shown in this book. However, headers that contain only prototypes are not. (For instance, Example 12.1 includes sort.h, but this header is not shown because it contains only prototypes to various sorting functions.)
Static functions are used for private functions
Static functions have file scope, so this fact is used to keep private functions private. Functions specific to a data structure or algorithm's implementation are thus kept out of its public interface.
Naming conventions are applied throughout the code
Defined constants appear entirely in uppercase. Datatypes and global variables begin with an uppercase character. Local variables begin with a lowercase character. Operations of abstract datatypes begin with the name of the type in lowercase, followed by an underscore, then the name of the operation in lowercase.
All code contains numerous comments
All comments are designed to let developers follow the logic of the code without reading much of the code itself. This is useful when trying to make connections between the code and explanations in the text.
Structures have typedefs as well as names themselves
The name of the structure is always the name in the typedef followed by an underscore. Naming the structure itself is necessary for self-referential structures like the one used for linked list elements (see Chapter 5). This approach is applied everywhere for consistency.
All void functions contain explicit returns
Although not required, this helps quickly identify where a void function returns rather than having to match up braces.
Conventions
Most of the conventions used in this book should be recognizable to those who work with computers to any extent. However, a few require some explanation.
Bold italic
Nonintrinsic mathematical functions and mathematical variables appear in this font.
Constant width italic
Variables from programs, names of datatypes (such as structure names), and defined constants appear in this font.
Italic
Commands (as they would be typed in at a terminal), names of files and paths, operations of abstract datatypes, and other functions from programs appear in this font.
lg x
This notation is used to represent the base-2 logarithm of x, log2 x. This is the notation used commonly in computer science when discussing algorithms; therefore, it is used in this book.
How to Contact Us
We have tested and verified the information in this book to the best of our ability, but you may find that features have changed (or even that we have made mistakes!). Please let us know about any errors you find, as well as your suggestions for future editions, by writing to:
O'Reilly & Associates, Inc.
1005 Gravenstein Highway North
Sebastopol, CA 95472
1-800-998-9938 (in the U.S. or Canada)
1-707-829-0515 (international/local)
1-707-829-0104 (FAX)
You can also send us messages electronically. To be put on the mailing list or request a catalog, send email to:
info@oreilly.com
To ask technical questions or comment on the book, send email to:
bookquestions@oreilly.com
We have a web site for the book, where we'll list examples, errata, and any plans for future editions. You can access this page at:
http://www.oreilly.com/catalog/masteralgoc/
For more information about this book and others, see the O'Reilly web site:
http://www.oreilly.com
Acknowledgments
The experience of writing a book is not without its ups and downs. On the one hand, there is excitement, but there is also exhaustion. It is only with the support of others that one can truly delight in its pleasures and overcome its perils. There are many people I would like to thank.