Medium · O(E log E)
Kruskal's Algorithm quiz
Answer the questions in your own time, change a pick whenever you like, then hand in to see your score and why each answer is right. Nothing is saved or sent.
Questions (10)
- Viewing
- Answered
- Not answered
An undirected graph with vertices 0 to 6 and these edges (u–v, weight): 0–1 (7), 0–3 (5), 1–2 (8), 1–3 (9), 1–4 (7), 2–4 (5), 3–4 (15), 3–5 (6), 4–5 (8), 4–6 (9), 5–6 (11). What is weight after kruskal(7, edges)?
On the same graph, union is called once for each edge the loop looks at. On how many of the 11 edges is it called?
A 4-cycle on vertices 0 to 3 whose edges all weigh 1, given in this order: 2–3, 0–1, 1–2, 3–0. Which edges does kruskal keep, in the order it adds them?
5 vertices and the edges 0–1 (1), 1–2 (2), 0–2 (3), 3–4 (4). There is no way from vertex 0 to vertex 3. What does kruskal(5, edges) return?
3 vertices and these edges, in this order: 0–0 (−4), 0–1 (5), 0–1 (−2), 1–2 (0), 2–0 (−1). What does kruskal(3, edges) return as weight?
4 vertices, and the edges 0–1, 2–3 and 1–2, all of weight 1, given in this order. After the loop, what is the disjoint set's parent array? (Ties in rank put b's root under a's root.)
On the graph from the first question, you negate every weight and run the same kruskal. What does that find?
A triangle on vertices 0, 1, 2 with the edges 0–1, 1–2 and 0–2, each of weight 1, given in this order. How many different minimum spanning trees does it have, and what does the listing return?
Which step takes the most time in Kruskal's algorithm on a graph with V vertices and E edges?
You delete the line if (groups.count === 1) break; from the loop. What changes in the result?
Progress
0 / 10 questions0%
10 questions left
Quiz details
- Total questions
- 10
- Answered
- 0
- Not answered
- 10
Take it further
- AnimationGraphs
Kruskal Animation
A glowing graph where the cheapest network builds itself: Kruskal's minimum spanning tree with a sorted edge list and union-find colours, for lessons and slides
Free
