ebook img

Data Structures and Their Algorithms PDF

525 Pages·1991·24.87 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Data Structures and Their Algorithms

-I AIe I -I~i Alb 000-=,,I; i =z = J Ad r Data Structures &Their Algorithms 4I Data Structures &Their0 Algorithms Harry R. Lewis Harvard University Larry Denenberg Harvard University m HarperCollinsPublisbers Unix is a registered trademark of AT&T. Let's Make a Deal! is a registered trademark of Hatos-Hall Productions. Tetris is a trademark of AcademySoft-ELORG. Rubik's Cube is a registered trademark of Seven Towns Limited, London. Ada is a registered trademark of the United States Government. IBM is a registered trademark of International Business Machines Corporation. Sponsoring Editor: Don Childress Project Editor: Janet Tilden Art Direction: Julie Anderson Cover Design: Matthew J. Doherty Production Administrator: Beth Maglione Printer and Binder: R. R. Donnelley & Sons Company Cover Printer: Phoenix Color Corp. Data Structures and Their Algorithms Copyright (1991 by Harry R. Lewis and Larry Denenberg All rights reserved. Printed in the United States of America. No part of this book may be used or reproduced in any manner whatsoever without written permis- sion, except in the case of brief quotations embodied in critical articles and reviews. For information address HarperCollins Publishers Inc., 10 East 53rd Street, New York, NY 10022. Library of Congress Cataloging-in-Publication Data Lewis, Harry R. Data structures and their algorithms / Harry R. Lewis, Larry Denenberg. p. cm. Includes bibliographical references and index. ISBN 0-673-39736-X 1. Data structures (Computer science) 2. Algorithms. I. Denenberg, Larry. II. Title. QA76.9.D35L475 1991 005.7'3--dc2O 90-23290 CIP 90 91 92 93 9 8 7 6 5 4 3 2 1 To Eunice and Norman Denenberg, and to Elizabeth and Anne Lewis Contents Preface xiii I INTRODUCTION 1.1 Programming as an Engineering Activity 1 1.2 Computer Science Background 3 Memory and Data in Von Neumann Computers Notation for Programs Locatives Abstract Data Types 1.3 Mathematical Background 17 Finite and Infinite Series Logarithms, Powers, and Exponentials Order Notation Recurrence Relations Naive Probability Theory Problems 36 References 44 ALGORITHM ANALYSIS 46 2.1 Properties of an Algorithm 46 Effectiveness Correctness Termination Efficiency Program Complexity 2.2 Exact vs. Growth-Rate Analysis 49 Principles of Mathematical Analysis Expected-Case and Amortized Analysis vii Viii CONTENTS 2.3 Algorithm Paradigms 59 Brute-Force and Exhaustive Search Greedy Algorithms Dynamic Programming NP-Completeness Problems 65 References 71 LI[ LISTS 73 3.1 List Operations 73 3.2 Basic List Representations 75 Stack Representation in Contiguous Memory Queue Representation in Contiguous Memory Stack Representation in Linked Memory Queue Representation in Linked Memory 3.3 Stacks and Recursion 79 3.4 List Representations for Traversals 84 3.5 Doubly Linked Lists 87 Problems 90 References 94 TREES 96 4.1 Basic Definitions 96 4.2 Special Kinds of Trees 100 4.3 Tree Operations and Traversals 103 4.4 Tree Implementations 108 Representation of Binary Trees Representation of Ordered Trees Representation of Complete Binary Trees 4.5 Implementing Tree Traversals and Scans 112 Stack-Based Traversals Link-Inversion Traversal Scanning a Tree in Constant Space Threaded Trees Implementing Level-Order Traversal Summary Problems 125 References 129 CONTENTS ix ARRAYS AND STRINGS 130 5.1 Arrays as Abstract Data Types 130 Multidimensional Arrays 5.2 Contiguous Representation of Arrays 133 Constant-Time Initialization 5.3 Sparse Arrays 138 List Representations Hierarchical Tables Arrays with Special Shapes 5.4 Representations of Strings 143 Huffman Encoding Lempel-Ziv Encoding 5.5 String Searching 154 The Knuth-Morris-Pratt Algorithm The Boyer-Moore Algorithm Fingerprinting and the Karp-Rabin Algorithm Problems 165 References 173 LIST AND TREE IMPLEMENTATIONS OF SETS 175 6.1 Sets and Dictionaries as Abstract Data Types 175 6.2 Unordered Lists 177 6.3 Ordered Lists 181 Binary Search Interpolation Search Skip Lists 6.4 Binary Search Trees 193 Insertion Deletion 6.5 Static Binary Search Trees 200 Optimal Trees Probability-Balanced Trees Median Split Trees Problems 208 References 216 X CONTENTS I IJTREE STRUCTURES FOR DYNAMIC DICTIONARIES 219 7.1 AVL Trees 219 Insertion Deletion 7.2 2-3 Trees and B-Trees 229 2-3 Trees Red-Black Trees (a, b)-Trees and B-Trees 7.3 Self-Adjusting Binary Search Trees 243 Problems 251 References 256 I SETS OF DIGITAL DATA 257 8.1 Bit Vectors 257 8.2 Tries and Digital Search Trees 260 8.3 Hashing Techniques 265 Chaining Strategies Open Addressing Strategies Deletions 8.4 Extendible Hashing 280 8.5 Hashing Functions 284 Hashing by Division Hashing by Multiplication Perfect Hashing of Static Data Universal Classes of Hash Functions Problems 291 References 296 SETS WITH SPECIAL OPERATIONS 298 9.1 Priority Queues 298 Balanced Tree Implementations Heaps Leftist Trees

Description:
Using only practically useful techniques, this book teaches methods for organizing, reorganizing, exploring, and retrieving data in digital computers, and the mathematical analysis of those techniques. The authors present analyses that are relatively brief and non-technical but illuminate the import
See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.