Data Structures & AlgorithmsVery hardICPC regional · GATE CS
Undirected simple graph on vertices 0 to 5 with weighted edges (u–v (w)): 3–5 (1), 3–4 (1), 1–4 (2), 0–4 (1), 1–2 (1), 2–4 (3), 1–3 (3), 0–3 (1), 4–5 (2). How many different minimum spanning trees does this graph have? Two spanning trees are different when their edge sets differ.
- A. 1
- B. 3
- C. 52
- D. 5
Correct answer: B. 3
Every minimum spanning tree has total weight 6. 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
- A directed acyclic graph on vertices 0 to 4 has exactly these edges (u→v means u must come before v): 0→1, 0→2, 0→4, 2→1, 3→2, 4→2. How…
- A directed acyclic graph on vertices 0 to 5 has exactly these edges (u→v means u must come before v): 1→0, 1→3, 1→4, 2→0, 2→3, 4→0, 4→2…
- A directed acyclic graph on vertices 0 to 5 has exactly these edges (u→v means u must come before v): 1→5, 3→0, 3→4, 3→5, 4→0, 4→1, 4→2…
- A directed acyclic graph on vertices 0 to 5 has exactly these edges (u→v means u must come before v): 1→0, 1→2, 1→3, 1→5, 2→0, 4→0, 4→1…
- A directed acyclic graph on vertices 0 to 5 has exactly these edges (u→v means u must come before v): 0→1, 2→0, 2→3, 2→4, 4→0, 5→0, 5→3…
- A directed acyclic graph on vertices 0 to 6 has exactly these edges (u→v means u must come before v): 1→3, 2→0, 2→3, 2→5, 4→0, 4→1, 4→3…