Data Structures & AlgorithmsModerateGATE CS

A simple undirected graph has 14 vertices and exactly 2 connected components. What is the maximum possible number of edges?

  1. A. 66
  2. B. 89
  3. C. 77
  4. D. 78

Correct answer: D. 78

Put 1 isolated vertices aside and make the remaining 13 vertices a complete graph: C(13, 2) = 78. Splitting vertices more evenly across components always gives fewer edges.

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic