Data Structures & AlgorithmsModerateInfosys · Cognizant pattern

A graph has 9 vertices and 3 connected components. How many edges does a minimum spanning FOREST (an MST of every component) contain?

  1. A. 8
  2. B. 9
  3. C. 6
  4. D. 3

Correct answer: C. 6

A spanning tree of a component with nᵢ vertices has nᵢ − 1 edges; summing over the 3 components gives 9 − 3 = 6. '8' (V − 1) applies only to a connected graph; Kruskal on this graph would stop after accepting 6 edges.

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic