Solution Manual for Data Structures and Algorithm Analysis in C, 2/E 2nd Edition : 0201498405pdf download
Solution Manual for Data Structures and Algorithm Analysis in C, 2/E 2nd Edition : 0201498405pdf download
http://testbankbell.com/product/solution-manual-for-data-
structures-and-algorithm-analysis-in-c-2-e-2nd-
edition-0201498405/
TestBankBell.com: Your Ultimate Source for Test Banks and Academic Resources
Keywords:
test bank, academic resources, study guides, test preparation, testbankbell, download test
bank, textbook solutions
Contact Information:
Visit us at: https://testbankbell.com - For inquiries, email us:
testbankbell.com@gmail.com
Important Links:
Download Test Banks: https://testbankbell.com/
https://testbankbell.com/product/solution-manual-for-data-structures-
and-algorithm-analysis-in-c-4-e-4th-edition-013284737x/
testbankbell.com
https://testbankbell.com/product/solution-manual-for-data-structures-
and-problem-solving-using-c-2-e-mark-a-weiss/
testbankbell.com
https://testbankbell.com/product/test-bank-for-data-structures-and-
algorithms-in-c-2nd-edition-by-goodrich/
testbankbell.com
https://testbankbell.com/product/solution-manual-for-data-structures-
and-algorithms-in-java-1st-edition-peter-drake/
testbankbell.com
Solution Manual for Data Networks, 2/E 2nd Edition :
0132009161
https://testbankbell.com/product/solution-manual-for-data-
networks-2-e-2nd-edition-0132009161/
testbankbell.com
https://testbankbell.com/product/solution-manual-for-data-structures-
and-other-objects-using-c-4-e-michael-main-walter-savitch/
testbankbell.com
https://testbankbell.com/product/solution-manual-for-c-programming-
program-design-including-data-structures-6th-edition-d-s-malik/
testbankbell.com
https://testbankbell.com/product/solution-manual-for-fundamentals-of-
python-data-structures-2nd-edition-kenneth-lambert/
testbankbell.com
https://testbankbell.com/product/test-bank-for-statistics-and-data-
analysis-for-nursing-research-2-e-2nd-edition-0135085071/
testbankbell.com
Solution Manual for Data Structures and
Algorithm Analysis in C, 2/E 2nd Edition :
0201498405
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 must solve have become larger and more complex, requiring
development of more intricate programs. 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 one-half to
three-quarters of an implementation, and the student is encouraged to supply the rest. Chapter 12,
which is new to this edition, discusses additional data structures with an emphasis on
implementation details.
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 Chapter 5). It also produces simplified
code in several places, usually because the and (&&) operations 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 only a few keystrokes
and no increased speed. I believe that this books 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 its major
weaknesses. Many examples are provided, including an in-depth explanation of logarithms running
time. Simple recursive programs are analyzed by intuitively converting them into iterative programs.
More complicated divide-and-conquer programs are introduced, but some of the analysis (solving
recurrence relations) is implicitly delayed until Chapter 7, where it is performed in detail.
Chapter 3 covers lists, stacks, and queues. The emphasis here is on coding these data structures
using ADTs, fast implementation of these data structures, and an exposition of some of their uses.
There are almost no programs (just routines), but the exercises contain plenty of ideas for
programming assignments.
Chapter 4 covers trees, with an emphasis on search trees, including external search trees (B-trees).
The UNIX file system and expression trees are used as examples. AVL trees and splay trees are
introduced but not analyzed. Seventy-five percent of the code is written, leaving similar cases to be
completed by the student. More careful treatment of search tree implementation details is found in
Chapter 12. Additional coverage of trees, such as file compression and game trees, is deferred until
Chapter 10. Data structures for an external medium are considered as the final topic in several
chapters.
Chapter 5 is relatively short chapter concerning hash tables. Some analysis is performed, and
extendible hashing is covered at the end of the chapter.
Chapter 6 is about priority queues. Binary heaps are covered, and there is additional material on
some of the theoretically interesting implementations of priority queues. The Fibonacci heap is
discussed in Chapter 11, and the pairing heap is discussed in Chapter 12.
Chapter 7 covers sorting. It is very specific with respect to coding details and analysis. All the
important general-purpose sorting algorithms are covered and compared. Four algorithms are
analyzed in detail: insertion sort, Shellsort, heapsort, and quicksort. The analysis of the average-
case running time of heapsort is new to this edition. External sorting is covered at the end of the
chapter.
Chapter 8 discusses the disjoint set algorithm with proof of the running time. This is a short and
specific chapter that can be skipped if Kruskal's algorithm is not discussed.
Chapter 9 covers graph algorithms. Algorithms on graphs are interesting, not only because they
frequently occur in practice but also because their running time is so heavily dependent on the
proper use of data structures. Virtually all of the standard algorithms are presented along with
appropriate data structures, pseudocode, and analysis of running time. To place these problems in a
proper context, a short discussion on complexity theory (including NP-completeness and
undecidability) is provided.
Chapter 12 is new to this edition. It covers search tree algorithms, the k-d tree, and the pairing heap.
This chapter departs from the rest of the text by providing complete and careful implementations for
the search trees and pairing heap. The material is structured so that the instructor can integrate
sections into discussions from other chapters. For example, the top-down red black tree in Chapter
12 can be discussed under AVL trees (in Chapter 4).
Chapters 1-9 provide enough material for most one-semester data structures courses. If time
permits, then Chapter 10 can be covered. A graduate course on algorithm analysis could cover
Chapters 7-11. The advanced data structures analyzed in Chapter 11 can easily be referred to in the
earlier chapters. The discussion of NP-completeness in Chapter 9 is far too brief to be used in such
a course. Garey and Johnson's book on NP-completeness can be used to augment this text.
Exercises
Exercises, provided at the end of each chapter, match the order in which material is presented. The
last exercises may address the chapter as a whole rather than a specific section. Difficult exercises
are marked with an asterisk, and more challenging exercises have two asterisks.
A solutions manual containing solutions to almost all the exercises is available to instructors from the
Addison-Wesley Publishing Company.
References
References are placed at the end of each chapter. Generally the references either are historical,
representing the original source of the material, or they represent extensions and improvements to
the results given in the text. Some references represent solutions to exercises.
Code Availability
The example program code in this book is available via anonymous ftp at aw. It is also accessible
through the World Wide Web; the URL is aw/cseng/authors/weiss/dsaac2/dsaac2e.sup.html (follow
the links from there). The exact location of this material may change.
Acknowledgments
Many, many people have helped me in the preparation of books in this series. Some are listed in
other versions of the book; thanks to all.
For this edition, I would like to thank my editors at Addison-Wesley, Carter Shanklin and Susan
Hartman. Teri Hyde did another wonderful job with the production, and Matthew Harris and his staff
at Publication Services did their usual fine work putting the final pieces together.
M.A.W.
Miami, Florida
July, 1996
0201498405P04062001
Of the Trick that Guzman played upon a Captain and a Lawyer, who came
to dine at the Ambassador’s without having been invited.
Nothing afforded my master more pleasure than seeing his genteel
acquaintance at his table; and he was often willing even to tolerate
parasites, provided their wit compensated for their entertainment; but he
was always much vexed at the appearance of the latter, when it so happened
that he had a select party to dine with him. This being the case, you may
well conceive that it was not without considerable pain that he saw two of
these hangers-on enter his room one day, when he expected the French
Ambassador and other persons of distinction to dine with him. One of these
was a Captain, and the other a Lawyer, neither of whom wanted merit in his
own line, but as they could talk on no other subject but their respective
professions, they had become quite a nuisance in the house.
The Ambassador could not help bowing as he saw them enter, of which,
however, they took not the slightest notice; and so far from taking their
leave after this cold reception, they seemed determined to stay, and joined
the rest of the company accordingly. My master looked at me, and I
understood in an instant that it would not displease him if I could in any
way divert the company at the expense of these gentlemen. Thus then I set
about it.
You must be informed, in the first place, that the Lawyer, who was a
grave, formal man, had a pair of huge whiskers, of which he took such
particular care, that he scarcely dared even to smile for fear of
discomposing them. I observed that he often took a sly peep at them with
great delight, in a little mirror which he drew out of his pocket with his
handkerchief, pretending all the while to be blowing his nose. Having taken
particular notice of this manœuvre of his, I waited patiently until the dessert
was placed on the table, when the conversation becoming lively, I soon had
an opportunity of putting my plan in execution. I then went up to the
Captain and whispered something to him which made him laugh. He
answered me in the same tone, and so I continued laughing and whispering
with him for a considerable time, always taking pains to look at the Lawyer,
to make him think that we were talking of him. At length, when I thought it
was time, I assumed a more serious air, and said aloud, as if still continuing
the conversation, “No, no, Captain, I am your most humble servant, but I
protest I can take no part in this joke, the respect that I owe my master, and
his friend the Lawyer, will not permit me to take such a liberty.”
“What’s the matter, Guzman?” said my master, hearing this. “Truly, sir,”
answered I, “the Captain can tell you better than I. He has been cracking
jokes upon the Lawyer’s whiskers for some time past, and now wishes me
to amuse the company with them.” “Come, come, Guzman,” said the
French Ambassador, “let us know the whole of it.” “Since my master and
you command it,” said I, “it is my duty to tell you. The Captain has been
informing me that Mr. Lawyer keeps a wench to comb and dye his whiskers
every morning, that they may not turn grey, and always sleeps on his back
for fear of rumpling them. In short he has been amusing me on this subject
for this quarter of an hour, trying to persuade me to repeat the jokes as
though they were of my own invention; but it is not for a boy like me to
rally so venerable a personage in this manner.”
The Captain, instead of denying what I asserted, laughed heartily, and all
the company followed his example, without knowing whether I spoke truth
or falsehood. The Lawyer hesitated for some moments how to take the joke;
but not being able any longer to withstand the noble Captain’s immoderate
laughter, “Rascal,” said he, in a rage, “you have good cause, truly, to rally
me upon my age, you who boast of your services under Charles V. whom
you never saw but in a picture! But I degrade myself by putting myself in
comparison with a man of your stamp.” “Very fine, Mr. Lawyer,”
interrupted the Captain, growing warm, “you forget the company we are in.
Were I not more reasonable than you,”——“More reasonable!” cried the
Lawyer in his turn, “why there is not a greater fool on the face of the earth.”
The Captain had now entirely lost all temper, and would doubtless have
answered his friend the Lawyer by throwing one of the plates at his head,
had not the company interfered, and appeased them both. Neither of them,
however, ventured to come to the house again; and thus I freed my master
of two other most troublesome guests.
CHAP. XXX.