Explore the differences and similarities between Kruskal’s and Prim’s algorithms for finding minimum spanning trees. This quiz highlights core concepts, algorithm steps, and common pitfalls relevant to graph theory and MST construction, helping learners strengthen their understanding of these essential algorithms.
When using Kruskal’s algorithm on a connected weighted graph, which criterion is used to select the next edge to be added to the minimum spanning tree?
Explanation: Kruskal’s algorithm always selects the edge with the smallest weight that connects two separate components, merging them without forming a cycle. The option about proximity to the starting vertex describes an aspect of Prim’s algorithm rather than Kruskal’s. Selecting the edge with the highest degree node is unrelated to either algorithm. The option about completing cycles is incorrect because Kruskal’s specifically avoids creating cycles at every step.
In Prim’s algorithm, what is the expected outcome after the first iteration given a weighted undirected graph with more than one vertex?
Explanation: After the first iteration of Prim’s algorithm, a single starting vertex and its minimum weight edge are in the spanning tree. Not all minimum edges are added at once—this happens sequentially. The algorithm does not visit all vertices or complete the MST in the first step; these processes occur incrementally as the algorithm runs.
Which technique is commonly used to ensure that cycles do not form when adding edges during Kruskal’s algorithm?
Explanation: Kruskal’s algorithm often employs the disjoint-set (union-find) data structure to quickly check if adding an edge will create a cycle. Depth-first search trees are mainly for traversal or detection, not for Kruskal’s union operations. Sorting vertices alphabetically is irrelevant to cycles. Prim’s uses a priority queue, but that's not a cycle avoidance technique for Kruskal’s.
Which algorithm is generally more efficient for finding an MST in a dense graph, and why?
Explanation: Prim’s algorithm is typically better suited for dense graphs because it focuses on expanding from connected nodes and uses data structures like heaps or priority queues that efficiently update the nearest connecting edge. Kruskal’s main advantage is with sparse graphs where the sorting step dominates. Both being equally efficient is incorrect, and Kruskal’s does not inherently skip most edges in dense graphs.
Which of the following best describes a key difference in how Kruskal’s and Prim’s algorithms begin constructing a minimum spanning tree?
Explanation: Prim’s algorithm requires a starting vertex and then expands from there, whereas Kruskal’s algorithm begins by selecting the minimum weight edge, independent of any starting vertex. Kruskal’s does not require an initial vertex, so that distractor is incorrect. Prim’s does not examine all edges at once, and both algorithms do not always start with the smallest edge—Prim’s depends on the starting vertex.