Data Structures & AlgorithmsHardICPC regional · GATE CS
Undirected simple graph on vertices 0 to 5 with weighted edges (u–v (w)): 1–5 (1), 0–2 (1), 0–5 (1), 3–5 (3), 0–3 (1), 3–4 (1), 2–5 (1). How many different minimum spanning trees does this graph have? Two spanning trees are different when their edge sets differ.
- A. 1
- B. 8
- C. 6
- D. 3
Correct answer: D. 3
Every minimum spanning tree has total weight 5. Enumerating the (n−1)-edge subsets that are trees shows 3 of them reach that weight, so the MST is not unique; one run of Kruskal hides this.
Practise more Trees, Graphs, Recursion and Dynamic Programming questionsTrees, Graphs, Recursion and Dynamic Programming: notes and key points
More Trees, Graphs, Recursion and Dynamic Programming questions
- Undirected simple graph on vertices 0 to 3 with weighted edges (u–v (w)): 2–3 (1), 1–2 (3), 0–1 (3), 0–2 (2), 0–3 (2), 1–3 (3). How many…
- Undirected simple graph on vertices 0 to 4 with weighted edges (u–v (w)): 3–4 (2), 0–4 (1), 1–2 (1), 2–3 (2), 1–4 (3), 1–3 (3), 0–3 (2)…
- Undirected simple graph on vertices 0 to 3 with weighted edges (u–v (w)): 1–2 (3), 0–3 (1), 0–1 (3), 0–2 (3), 1–3 (3). How many different…
- Undirected simple graph on vertices 0 to 4 with weighted edges (u–v (w)): 2–3 (3), 1–2 (3), 1–3 (2), 0–4 (1), 0–3 (3), 0–1 (1). How many…
- Undirected simple graph on vertices 0 to 4 with weighted edges (u–v (w)): 1–3 (3), 0–4 (3), 3–4 (1), 1–4 (1), 2–3 (3), 2–4 (2), 1–2 (2)…
- Undirected simple graph on vertices 0 to 5 with weighted edges (u–v (w)): 3–5 (3), 0–5 (3), 1–4 (3), 1–5 (3), 2–4 (3), 2–5 (3), 2–3 (1)…