Tải bản đầy đủ (.pdf) (7 trang)

a0014 c plus plus plus data structure morebook vn 5185

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (1.98 MB, 7 trang )

CData
++

Plus

Structures
Third Edition

Nell Dale
JONES AND BARTLETT COMPUTER SCIENCE
TEAM LinG - Live, Informative, Non-cost and Genuine!


CData
++

Plus

Structures
Third Edition

Nell Dale

University of Texas, Austin

TEAM LinG - Live, Informative, Non-cost and Genuine!


World Headquarters
Jones and Bartlett Publishers
40 Tall Pine Drive


Sudbury, MA 01776
978-443-5000

www.jbpub.com

Jones and Bartlett Publishers
Canada
2406 Nikanna Road
Mississauga, ON L5C 2W6
CANADA

Jones and Bartlett Publishers
International
Barb House, Barb Mews
London W6 7PA
UK

Copyright © 2003 by Jones and Bartlett Publishers, Inc.
Cover image © Douglas E. Walker / Masterfile
All rights reserved. No part of the material protected by this copyright notice may be reproduced or utilized
in any form, electronic or mechanical, including photocopying, recording, or any information storage or
retrieval system, without written permission from the copyright owner.
Chief Executive Officer: Clayton Jones
Chief Operating Officer: Don W. Jones, Jr.
Executive V.P. and Publisher: Robert Holland
V.P., Design and Production: Anne Spencer
V.P., Manufacturing and Inventory Control: Therese Bräuer
Editor-in-Chief, College: J. Michael Stranz
Production Manager: Amy Rose
Marketing Manager: Nathan Schultz

Associate Production Editor: Karen Ferreira
Editorial Assistant: Theresa DiDonato
Production Assistant: Jenny McIsaac
Cover Design: Night & Day Design
Composition: Northeast Compositors, Inc.
Text Design: Anne Spencer
Printing and Binding: Courier Westford
Cover Printing: Lehigh Press
Library of Congress Cataloging-in-Publication Data
Dale, Nell B.
C++ plus data structures / Nell Dale.—3rd ed.
p. cm.
ISBN 0-7637-0481-4
1. C++ (Computer program language) 2. Data structures (Computer science) I. Title.
QA76.73.C153 D334 2003
005.7’3—dc21
2002034168
This book was typeset in Quark 4.1 on a Macintosh G4. The font families used were Rotis Sans Serif, Rotis
Serif, and Prestige Elite. The first printing was printed on 45# Highland Book.
Printed in the United States of America
06 05 04 03 02
10 9 8 7 6 5 4 3 2 1

TEAM LinG - Live, Informative, Non-cost and Genuine!


To Al, my husband and best friend, to our children and our
children's children, and to our dogs Maggie and Chrissie,
who round out our family.
N.D.


TEAM LinG - Live, Informative, Non-cost and Genuine!


TEAM LinG - Live, Informative, Non-cost and Genuine!


Index

and unsorted array, 610
TreeType class, 463, 464
true value, 35
try block, 96, 206
try–catch statement, 34, 96, 97
try clause, 96
Two–dimensional arrays, 82–85
application level, 84
implementation level, 84–85
logical level, 82–83
as parameters, 83–84
Two–element subarrays, 608
Type conflicts, 49
typedef statement, 84, 285
TYPE MISMATCH error message, 23

U
UML. See Unified Modeling Language
Unary operators
overloading, 358
Undirected graph, 547, 548, 549

complete, 550
Unhandled exceptions, 294
Unified Modeling Language, 4, 13
Union, 571
Unique keys, 124
Unit testing, 35, 44
Universal set, 571
Unsorted array
and tree, 610
Unsorted linked list
retrieving an item in, 312
Unsorted List ADT, 146, 188, 252, 373
application level, 131–132
implementation level, 132–135
operations specified for, 135–143
specification for, 128–130
Unsorted List ADT algorithms
comparison of Sorted List ADT algorithms with,
164–167
Unsorted List ADT as linked data structure
implementing, 307–317

|

815

comparing unsorted list implementations,
316–317
and DeleteItem function, 314–315
and InsertItem function, 313

and MakeEmpty function, 310–311
and ResetList and GetNextItem functions,
315–316
and RetrieveItem function, 311–313
Unsorted list implementations
comparing, 316–317
Unsorted lists, 124
deleting items in, 141
and implementing priority queues, 532
inserting items in, 189
retrieving items in, 138
UnsortedType class, 143, 147, 309, 589
CRC card for, 128
data members of, 134
Unstructured composite type, 72
UpdateQue function, 253, 254, 259
UpdateServers operation, 252, 259
Usability, 5
User–defined string I/O class case study, 100–116
User errors, 25
using declaration, 99
using directive, 25, 99

V
Value
passing pointers by, 475
ValueInList function, 436, 438
code for, 410
iterative version of, 433
in midexecution, 410

verifying with Three–Question Method, 411
writing, 408-410
Value parameter, 74, 75
Values
splitting, 444, 446
in test plans, 145
Variables
lifetime of, 224

TEAM LinG - Live, Informative, Non-cost and Genuine!


816

|

Index

Verbs, 18, 64, 173
in real estate listings case study, 173, 174
Verification
of program correctness, 28
requirements, 50
research, 28
of software correctness, 19–50
VertexType, 555, 563
Vertex (vertices), 547, 550, 551
indexes of, 567
marking on graphs, 555
V(graph), 563, 564, 567

Virtual functions, 95, 368-373, 392
virtual reserved word, 368
Visual tools, 13–14
Void function, 415

Wait time, 246, 259
formula for, 247
Walk–throughs, 31
of binary search algorithm, 154
of factorial(4), 406
of Factorial function, 426–429
scenario, 173
Weighted graph, 549, 550
WeightIs operation, 568
Well–formed expressions, 200
while statement, 137, 432
White–box testing strategy, 391
Whitespace, 26, 100
Writing
detailed specifications, 8–9
recursive functions, 408–411

Z
W
Waiting lines, 244, 249

Zero, 36
division by, 258

TEAM LinG - Live, Informative, Non-cost and Genuine!




×