 1 
Recall and follow the
General notes
from lab 1.
In this lab, you will be studying the performance of Kruskal’s algorithm for the minimum
spanning tree and the performance of the partition data structure.
Detailed instructions:
1.
(15 points) In this part, we’ll study the impact of the two optimizations used by the
Partition data structure. Modify the data structure by adding a variable called
noOpt
,
which is initialized by a second argument to the constructor. When
noOpt
=0, the new
version should implement both optimizations. When
noOpt
=1, it should omit the path
compression optimization. When
noOpt
=2, it should omit the linkbyrank optimization.
When
noOpt
=3, it should omit both. Modify the implementation of Kruskal’s algorithm
similarly, by adding a
noOpt
argument and passing it on to the Partition object when it is
created. Turn in a copy of the modified source for the Partition data structure.
Produce two charts showing the number of find steps performed by Kruskal’s algorithm
for all four values of
noOpt
and for graphs of varying size. You can use the
findcount
()
method of the Partition object to obtain the number of find steps performed during the
running of Kruskal’s algorithm. In the first plot, let
n
grow from 2
8
up to 2
16
and let
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
This is the end of the preview.
Sign up
to
access the rest of the document.
 Spring '12
 JonTurner
 Algorithms, Graph Theory, Data Structures, Kruskal's algorithm, Kruskal, partition data structure

Click to edit the document details