Accept or reject?
Warm-up · Multiple choice · about 3 min
Kruskal has accepted A-C (1) and B-C (2). The next edge in sorted order is A-B (3). What does Kruskal do with it?
Example 1
Input:
{"n":6,"edges":[[0,1,3],[0,2,1],[1,2,2],[1,3,6],[2,4,5],[3,4,4],[3,5,7],[4,5,8]]}
Output:
Reject A-B
find(A) and find(B) both give A.
Learn the idea first: Kruskal's algorithm, a visual lesson.
More Kruskal's algorithm problems
- MST edges in order Warm-up
- Implement Kruskal Standard
- Min cost to connect points Standard
- Spot the bug: linking the wrong vertex Standard
- Critical and pseudo-critical edges Challenge