# 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...

Please join StudyMode to read the full document