Chapter 9: Graph Algorithms
The following ordering is arrived at by using a queue and assumes that vertices appear on an
adjacency list alphabetically. The topological order that results is then
s, G, D, H, A, B, E, I, F, C, t
Assuming the same ad
Algorithm Analysis in C
Mark Allen Weiss
Florida International University
Included in this manual are answers to most of the exercises in the textbook Data Structures and
Algorithm Analysis in
Chapter 5: Hashing
(a) On the assumption that we add collisions to the end of the list (which is the easier way if
a hash table is being built by hand), the separate chaining hash table that results is shown
Chapter 8: The Disjoint Set ADT
We assume that unions operated on the roots of the trees containing the arguments. Also, in
case of ties, the second tree is made a child of the first. Arbitrary union and union by height
give the same answer (shown as
(b) The information-theoretic lower bound is log 2N
N . Applying Stirlings formula, we
can estimate the bound as 2NO 2log NO. A better lower bound is known for this case:
2NO1 comparisons are necessary. Merging two lists of different sizes MO and NO
Chapter 6: Priority Queues (Heaps)
Yes. When an element is inserted, we compare it to the current minimum and change the
minimum if the new element is smaller. DeleteMinO operations are expensive in this
Chapter 3: Lists, Stacks, and Queues
The comments for Exercise 3.4 regarding the amount of abstractness used apply here. The
running time of the procedure in Fig. 3.1 is O (L + P ).
PrintLots( List L, List P )
Chapter 4: Trees
(a) A .
(b) G , H , I , L , M , and K .
For node B :
(a) A .
(b) D and E .
(c) C .
There are N nodes. Each node has two pointers, so there are 2N pointers. Each node but
the root ha
Chapter 1: Introduction
Because of round-off errors, it is customary to specify the number of decimal places that
should be included in the output and round up accordingly. Otherwise, numbers come out
looking strange. We assume error checks have alrea
Chapter 10: Algorithm Design Techniques
First, we show that if NO evenly divides PO, then each of PjO(iO1)PO+1 through PjiPO must be
placed as the iOthO job on some processor. Suppose otherwise. Then in the supposed
optimal ordering, we must be able
Chapter 2: Algorithm Analysis
2/NO, 37, MM
NOO, NO, NOlog log NO, NOlog NO, NOlog (NO2), NOlog2NO, NO1.5, NO2, NO2log NO, NO3, 2NO/ 2,
2 . NOlog NO and NOlog (NO2) grow at the same rate.
(b) False. A counterexample is TO1(NO) = 2NO, T