Data Structures & AlgorithmsVery hardGATE CS · Product-company placement

A directed graph on A–H has edges A→G, A→H, B→D, B→E, B→H, F→A, F→D, F→E, G→B, H→C, H→D. How many strongly connected components does it have, and what is the minimum number of edges that must be added to make the whole graph strongly connected?

  1. A. 8 SCCs, 3 edges
  2. B. 8 SCCs, 7 edges
  3. C. 7 SCCs, 3 edges
  4. D. 8 SCCs, 2 edges

Correct answer: A. 8 SCCs, 3 edges

The SCCs are A | B | C | D | E | F | G | H. In the condensation DAG count sources (in-degree 0) and sinks (out-degree 0); the answer is max(sources, sinks) = 3.

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic