ACM Inroads | 2019

ITiCSE best paper

 

Abstract


The computation of a minimum spanning tree (MST) is a fundamental topic in any algorithms course. In this paper, we outline a series of projects based on a thorough exploration of the performances of two well-known MST algorithms: Prim’s and Kruskal’s. For a graph of n nodes and e edges, both run in O (e lgn) time but these results are based on picking the right data structures. Prim’s relies on a priority queue that supports priority modification in O (lgn) time while Kruskal’s relies on a disjoint-set that supports find/union operations in O (lgn) time. The performance ramifications of using simpler data structures allow students to thoroughly understand the operations of these two algorithms, get a deeper comprehension of asymptotic complexity analysis, negotiate empirical results with analytical predictions, and illustrate the value of “programming to the interface”. Our study also includes the performance consequences of the qualities of the graphs on which MSTs are computed: structure (random vs scale-free), density (sparse vs dense), and edge cost distribution. Finally, as an additional inquiry to engage students in a somewhat unexplored direction, we focus on the average pairwise-distance of the MSTs produced by Prim’s vs Kruskal’s.

Volume 10
Pages 57 - 63
DOI 10.1145/3306149
Language English
Journal ACM Inroads

Full Text