# Data Structures and Algorithm Analysis in C - Mark Allen Weiss

**Topics:**Algorithm, Analysis of algorithms, Recursion

**Pages:**257 (72871 words)

**Published:**August 24, 2011

页码，1/1

Data Structures and Algorithm Analysis in C

by Mark Allen Weiss

PREFACE CHAPTER 1: INTRODUCTION CHAPTER 2: ALGORITHM ANALYSIS CHAPTER 3: LISTS, STACKS, AND QUEUES CHAPTER 4: TREES CHAPTER 5: HASHING CHAPTER 6: PRIORITY QUEUES (HEAPS) CHAPTER 7: SORTING CHAPTER 8: THE DISJOINT SET ADT CHAPTER 9: GRAPH ALGORITHMS CHAPTER 10: ALGORITHM DESIGN TECHNIQUES CHAPTER 11: AMORTIZED ANALYSIS

mk:@MSITStore:K:\Data.Structures.and.Algorithm.Analysis.in.C.chm::/...

2006-1-27

Structures, Algorithm Analysis: PREFACE

页码，1/4

PREFACE Purpose/Goals

Return to Table of Contents

Next Chapter

This book describes data structures, methods of organizing large amounts of data, and algorithm analysis, the estimation of the running time of algorithms. As computers become faster and faster, the need for programs that can handle large amounts of input becomes more acute. Paradoxically, this requires more careful attention to efficiency, since inefficiencies in programs become most obvious when input sizes are large. By analyzing an algorithm before it is actually coded, students can decide if a particular solution will be feasible. For example, in this text students look at specific problems and see how careful implementations can reduce the time constraint for large amounts of data from 16 years to less than a second. Therefore, no algorithm or data structure is presented without an explanation of its running time. In some cases, minute details that affect the running time of the implementation are explored. Once a solution method is determined, a program must still be written. As computers have become more powerful, the problems they solve have become larger and more complex, thus requiring development of more intricate programs to solve the problems. The goal of this text is to teach students good programming and algorithm analysis skills simultaneously so that they can develop such programs with the maximum amount of efficiency. This book is suitable for either an advanced data structures (CS7) course or a first-year graduate course in algorithm analysis. Students should have some knowledge of intermediate programming, including such topics as pointers and recursion, and some background in discrete math.

Approach

I believe it is important for students to learn how to program for themselves, not how to copy programs from a book. On the other hand, it is virtually impossible to discuss realistic programming issues without including sample code. For this reason, the book usually provides about half to three-quarters of an implementation, and the student is encouraged to supply the rest. The algorithms in this book are presented in ANSI C, which, despite some flaws, is arguably the most popular systems programming language. The use of C instead of Pascal allows the use of dynamically allocated arrays (see for instance rehashing in Ch. 5). It also produces simplified code in several places, usually because the and (&&) operation is short-circuited. Most criticisms of C center on the fact that it is easy to write code that is barely readable. Some of the more standard tricks, such as the simultaneous assignment and testing against 0 via if (x=y)

are generally not used in the text, since the loss of clarity is compensated by

mk:@MSITStore:K:\Data.Structures.and.Algorithm.Analysis.in.C.chm::/...

2006-1-27

Structures, Algorithm Analysis: PREFACE

页码，2/4

only a few keystrokes and no increased speed. I believe that this book demonstrates that unreadable code can be avoided by exercising reasonable care.

Overview

Chapter 1 contains review material on discrete math and recursion. I believe the only way to be comfortable with recursion is to see good uses over and over. Therefore, recursion is prevalent in this text, with examples in every chapter except Chapter 5. Chapter 2 deals with algorithm analysis. This chapter explains asymptotic analysis and...

References: 2. M. R. Brown and R. E. Tarjan, "Design and Analysis of a Data Structure for Representing Sorted Lists," SIAM Journal on Computing 9 (1980), 594-614.

3. M. L. Fredman and R. E. Tarjan, "Fibonacci Heaps and Their Uses in Improved Network Optimization Algorithms," Journal of the ACM 34 (1987), 596-615.

4. H. Gajewska and R. E. Tarjan, "Deques with Heap Order," Information Processing Letters 22 (1986), 197-200.

5. G. Port and A. Moffat, "A Fast Algorithm for Melding Splay Trees," Proceedings of the First

Workshop on Algorithms and Data Structures, 1989, 450-459.

6. D. D. Sleator and R. E. Tarjan, "Self-adjusting Binary Search Trees," Journal of the ACM 32 (1985), 652-686.

7. D. D. Sleator and R. E. Tarjan, "Amortized Efficiency of List Update and Paging Rules," Communications of the ACM 28 (1985), 202-208.

8. D. D. Sleator and R. E. Tarjan, "Self-adjusting Heaps," SIAM Journal on Computing 15 (1986), 52-69.

Methods 6 (1985), 306-318.

10. J. Vuillemin, "A Data Structure for Manipulating Priority Queues," Communications of the ACM 21 (1978), 309-314. Return to Table of Contents

mk:@MSITStore:K:Data.Structures.and.Algorithm.Analysis.in.C.chm::/...

Please join StudyMode to read the full document