Preface Part I Preliminaries Chapter 1 Data Structures and Algorithms 1.1 A Philosophy of Data Structures 1.1.1 The Need for Data Structures 1.1.2 Costs and Benefits 1.1.3 Goals of This Book 1.2 Abstract Data Types and Data Structures 1.3 Problems,Algorithms,and Programs 1.4 Algorithm Efficiency 1.5 Further Reading 1.6 Exercises Chapter 2 Mathematical Preliminaries 2.1 Sets 2.2 Miscellaneous Notation 2.3 Logarithms 2.4 Recursion 2.5 Summations and Recurrences 2.6 Mathematical Proof Techniques 2.6.1 Proof by Contradiction 2.6.2 Proof by Mathematical Induction 2.7 Estimating 2.8 Further Reading 2.9 Exercises Chapter 3 Algorithm Analysis 3.1 Introduction 3.2 Best,Worst,and Average Cases 3.3 A Faster Computer,or a Faster Algorithm? 3.4 Asymptotic Analysis 3.4.1 Upper Bounds 3.4.2 Lower Bounds 3.4.3 Q Notation 3.4.4 Simplifying Rules 3.5 calculating the Running Time of a Program 3.6 Analyzing Problems 3.7 Multiple Parameters 3.8 Space Bounds 3.9 Some Practical Considerations 3.10 Further Reading 3.11 Exercises 3.12 Projects Part II fundamental Data Structures Chapter 4 Lists,Stacks,and Queues 4.1 Lists 4.1.1 Array-Based List Implementation 4.1.2 Linked List 4.1.3 Comparison of List Implementations 4.1.4 Element Implementations 4.1.5 Doubly Linked List 4.1.6 Circular Linked Lists 4.2 Stacks 4.2.1 Array-Based Stacks 4.2.2 Linked Stacks 4.2.3 Comparison of Array-Based and Linked Stacks 4.2.4 Implementing Recursion 4.3 Queues 4.3.1 Array-Based Queues 4.3.2 Linked Queues 4.3.3 Comparison of Array-Based and Linked Queues 4.4 Exercises 4.5 Projects Chapter 5 Binary Trees 5.1 Definitions and Properties 5.1.1 The Full Binary Tree Theorem 5.1.2 A Binary Tree Node ADT 5.2 Binary Tree Traversals 5.3 Binary Tree Implementations 5.3.1 Pointer-Based Node Implementations 5.3.2 Space Requirements 5.3.3 Array Implementation for Complete Binary Trees 5.4 Huffman Coding Trees 5.4.1 Building Huffman Coding Trees 5.4.2 Assigning and Using Huffman Codes 5.5 Binary Search Trees 5.6 Heaps and Priority Queues 5.7 Further Reading 5.8 Exercises 5.9 Projects Chapter 6 General Trees 6.1 General Tree Definitions and Terminology 6.1.1 An ADT for General Tree Nodes 6.1.2 General Tree Traversals 6.2 The Parent Pointer Implementation 6.3 General Tree Implementations 6.3.1 List of Children 6.3.2 The Left Child/Right Sibling Implementation 6.3.3 Dynamic Node Implementations 6.3.4 Dynamic“Left Child/Right Sibling”Implementation 6.4 K-ary Trees 6.5 Sequential Tree Implementations 6.6 Further Reading 6.7 Exercises 6.8 Projects Chapter 7 Graphs 7.1 Terminology and Representations 7.2 Graph Implementations 7.3 Graph Traversals 7.3.1 Depth-First Search 7.3.2 Breadth-First Search 7.3.3 Topological Sort 7.4 Shortest-Paths Problems 7.4.1 Single-Source Shortest Paths 7.4.2 All-Pairs Shortes Paths 7.5 Minimum-Cost Spanning Trees 7.5.1 Prim's Algorithm 7.5.2 Kruskal;s Algorithm 7.6 Further Reading 7.7 Exercises 7.8 Projects Part III Sorting and Searching Chapter 8 Internal Sorting 8.1 sorting Terminology and Notation 8.2 Three Sorting Algorithms 8.2.1 Insertion Sort 8.2.2 Bubble Sort 8.2.3 Selection Sort 8.2.4 The Cost of Exchange Sorting 8.3 Shellsort 8.4 Quicksort 8.5 Mergesort 8.6 Heapsort 8.7 Binsort and Radix Sort 8.8 An Empirical Comparison of Sorting Algorithms 8.9 Lower Bounds for Sorting 8.10 Further Reading 8.11 Exercises 8.12 Projects Chapter 9 File Processing and External Sorting 9.1 Primary Versus Secondary Storage 9.2 Disk and Tape Drives 9.2.1 Disk Access Costs 9.2.2 Magnetic Tape 9.3 Buffers and Buffer Pools 9.4 The Programmer's View of Files 9.5 External Sorting 9.6 Simple Approaches to External Sorting 9.7 Replacement Selection 9.8 Multiway Merging 9.9 Further Reading 9.10 Exercises 9.11 Projects Chapter 10 Searching 10.1 Searching Sorted Arrays 10.2 Self-Organizing Lists 10.3 Searching in Sets 10.4 Hashing 10.4.1 Hash Functions 10.4.2 Open Hashing 10.4.3 Closed Hashing 10.5 Further Reading 10.6 Exercises 10.7 Projects Chapter 11 Indexing 11.1 Linear Indexing 11.2 ISAM 11.3 Tree Indexing 11.4 2-3 Trees 11.5 B-Trees 11.5.1 B+-Trees 11.5.2 B-Tree Analysis 11.6 Further Reading 11.7 Exercises 11.8 Projects Part IV Applications and Advanced Topics Chapter 12 Lists and Arrays Revisited 12.1 Skip Lists 12.2 Multilists 12.3 Matrix Representations 12.4 Memory Management 12.4.1 Dynamic Storage Allocation 12.4.2 Failure Policies and Garbage Collection 12.5 Further Reading 12.6 Exercises 12.7 Projects Chapter 13 Advanced Tree Structures 13.1 Tries 13.2 Splay Trees 13.3 Spatial Data Structures 13.3.1 The K-D Tree 13.3.2 The PR quadtree 13.3.3 Other Spatial Data Structures 13.4 Further Reading 13.5 Exercises 13.6 Projects Chapter 14 Analysis Techniques 14.1 Summation Techniques 14.2 Recurrence Relations 14.2.1 Estimating Upper and Lower Bounds 14.2.2 Expanding Recurrences 14.2.3 Divide and Conquer Recurrences 14.2.4 Average-Case Analysis of Quicksort 14.3 Amortized Analysis 14.4 Further Reading 14.5 Exercises 14.6 Projects Chapter 15 Limits to Computation 15.1 Introduction 15.2 Reductions 15.3 Hard Problems 15.3.1 NP-Completeness 15.3.2 Getting Around NP-Complete Problems 15.4 Impossible Problems 15.4.1 Uncountability 15.4.2 The Halting Problem is Unsolvable 15.4.3 Determining Program Behavior is Unsolvable 15.5 Further Reading 15.6 Exercises 15.7 Projects Part V Appendix Appendix A Java Tutorial for C and Pascal Programmers A.1 Example 1:Interface for Lists A.2 Example 2:Array-Based List Implementation A.3 Example 3:Linked List Implementation Bibliography