The famous
mathematician, physician, theologian and philosopher Sir Isaac Newton
(1642?1727) once wrote, "If I had seen further [than certain other people], it
is by standing on the shoulders of giants." This is very true in computer
programming as well. Imagine if all programmers had to discover for themselves
by trial and error how to solve common problems in programming. It is much
better to learn the solutions that other programmers have already discovered and
build upon that foundation.
This book is about those foundational solutions. It describes how to structure
data and build algorithms to solve common programming tasks. Some of these
techniques have names that come from ordinary non-computer life ? e.g. stacks,
queues and sorting ? and others have names that might be completely unfamiliar
to a new student of programming ? e.g. recursion, backtracking and arrays.
Occasionally, a new tool is discovered, or at least, refined, but most of the
techniques in this book are standards in the programmer's tool chest.
Unlike the majority of textbooks in the field, this book takes a "code first"
approach. After a brief introduction of the concepts, a short complete ANSI-C
program is presented for students to analyse. A number of questions arising from
the code are then posed and answered in the Socratic format. In this way, the
reader will not only become fluent in the concepts but also in the nuts and
bolts of translating these concepts into functioning, efficient standard C code.
Variable pointer diagrams are developed and used extensively to aid
understanding of the more complex data structures and their manipulation.
"A
picture is worth a thousand words," as the saying goes, and what more a movie?
The animation movies on the accompanying CD-ROM illustrate different data
structures and algorithms, making concepts which may be difficult to grasp on
paper easier to understand.
New Page 1
Preface
About the Authors
Part 1: Structuring Data
1 Structuring Data:
Variables and Pointers
2 Structuring Data:
Arrays and Records
3
Structuring Data: Linked Lists
4 Structuring Data:
Trees
5 Structuring Data:
Graphs and Sets
Part 2: Building Algorithms
6 Building
Algorithms: Basic Techniques
7 Building
Algorithms: Key Concepts
Part 3: Algorithms and Data
Structures in Action
8 Searching
9 Sorting
10 NP-hard
Problems
Part 4: Theory of Computing
11 Finite
State Automata
12 Turing
Machines
Appendix: Annotated Bibliography
Answers
to Problems
Index