Ada Notes 1
Ada Notes 1
Epilogue 471
APPENDIX A
Useful Formulas for the Analysis of Algorithms 475
APPENDIX B
Short Tutorial on Recurrence Relations 479
References 493
Hints to Exercises 503
Index 547
v
Contents
Preface xix
1 Introduction 1
1.1 What Is an Algorithm? 3
Exercises 1.1 7
1.2 Fundamentals of Algorithmic Problem Solving 9
Understanding the Problem 9
Ascertaining the Capabilities of the Computational Device 9
Choosing between Exact and Approximate Problem Solving 11
Algorithm Design Techniques 11
Designing an Algorithm and Data Structures 12
Methods of Specifying an Algorithm 12
Proving an Algorithm’s Correctness 13
Analyzing an Algorithm 14
Coding an Algorithm 15
Exercises 1.2 17
1.3 Important Problem Types 18
Sorting 19
Searching 20
String Processing 20
Graph Problems 21
Combinatorial Problems 21
Geometric Problems 22
Numerical Problems 22
Exercises 1.3 23
vii
viii Contents
4 Decrease-and-Conquer 131
5 Divide-and-Conquer 169
6 Transform-and-Conquer 201
6.1 Presorting 202
Exercises 6.1 205
6.2 Gaussian Elimination 208
LU Decomposition 212
Computing a Matrix Inverse 214
Computing a Determinant 215
Exercises 6.2 216
6.3 Balanced Search Trees 218
AVL Trees 218
2-3 Trees 223
Exercises 6.3 225
6.4 Heaps and Heapsort 226
Notion of the Heap 227
Heapsort 231
Exercises 6.4 233
6.5 Horner’s Rule and Binary Exponentiation 234
Horner’s Rule 234
Binary Exponentiation 236
Exercises 6.5 239
6.6 Problem Reduction 240
Computing the Least Common Multiple 241
Counting Paths in a Graph 242
Reduction of Optimization Problems 243
Linear Programming 244
Reduction to Graph Problems 246
Exercises 6.6 248
Summary 250
Epilogue 471
APPENDIX A
Useful Formulas for the Analysis of Algorithms 475
Properties of Logarithms 475
Combinatorics 475
Important Summation Formulas 476
Sum Manipulation Rules 476
Contents xv
APPENDIX B
Short Tutorial on Recurrence Relations 479
Sequences and Recurrence Relations 479
Methods for Solving Recurrence Relations 480
Common Recurrence Types in Algorithm Analysis 485
References 493
Index 547