Preface xiii
I Foundations
Introduction 3
1 The Role of Algorithms in Computing 5
2 Getting Started 17
3 Characterizing Running Times 49
4 Divide-and-Conquer 76
5 Probabilistic Analysis and Randomized Algorithms 126
II Sorting and Order Statistics
Introduction 157
6 Heapsort 161
7 Quicksort 182
8 Sorting in Linear Time 205
9 Medians and Order Statistics 227
III Data Structures
Introduction 249
10 Elementary Data Structures 252
11 Hash Tables 272
12 Binary Search Trees 312
12 Red-Black Trees 331
IV Advanced Design and Analysis Techniques
Introduction 361
14 Dynamic Programming 362
15 Greedy Algorithms 417
16 Amortized Analysis 448
V Advanced Data Structures
Introduction 477
17 Augmenting Data Structures 480
18 B-Trees 497
19 Data Structures for Disjoint Sets 520
VI Graph Algorithms
Introduction 547
20 Elementary Graph Algorithms 549
21 Minimum Spanning Trees 585
22 Single-Source Shortest Paths 604
23 All-Pairs Shortest Paths 646
24 Maximum Flow 670
25 Matchings in Bipartite Graphs 704
VII Selected Topics
Introduction 745
26 Parallel Algorithms 748
27 Online Algorithms 791
28 Matrix Operations 819
29 Linear Programming 850
30 Polynomials and the FFT 877
31 Number-Theoretic Algorithms 903
32 String Matching 957
33 Machine-Learning Algorithms 1003
34 NP-Completeness 1042
35 Approximation Algorithms 1104
VIII Appendix: Mathematical Background
Introduction 1139
A Summations 1140
B Sets, Etc. 1153
C Counting and Probability 1178
D Matrices 1214
Bibliography 1227
Index 1251