Data Structures & AlgorithmsHardGATE CS · ICPC regional · Product Company SDE

A forest has 10 vertices and 2 connected components (trees). How many edges does it have?

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

Correct answer: B. 8

Each tree has (vertices − 1) edges, so the forest has 10 − 2 = 8.

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic