Intermediate
Discrete Mathematics & Math
Q78 / 100
What does Kruskal's algorithm compute, and what greedy rule does it follow?
Correct! Well done.
Incorrect.
The correct answer is B) A minimum spanning tree, by repeatedly adding the smallest-weight edge that does not create a cycle
B
Correct Answer
A minimum spanning tree, by repeatedly adding the smallest-weight edge that does not create a cycle
Explanation
Kruskal's algorithm sorts all edges by weight and greedily adds each edge to the growing forest as long as it does not form a cycle (checked via union-find), producing a minimum spanning tree. Prim's algorithm achieves the same goal by growing a single tree from a vertex.
Progress
78/100