GATE CS 2008 · Graph Traversals (BFS & DFS)

MCQ · 1 mark · Problem PROG-GRPH-0096

The most efficient algorithm for finding the number of connected components in an undirected graph on n vertices and m edges has time complexity
  1. A
    \(\Theta (n)\)
  2. B
    \(\Theta (m)\)
  3. C
    \(\Theta (m+n)\)
  4. D
    \(\Theta (mn)\)

Solve it on GATE DA practice →More Graph Theory & Algorithms problems

Show the worked solutionOfficial GATE Answer Key: Option C.See full step-by-step discussion on GateOverflow: https://gateoverflow.in/405/gate2008-7

GATE DA practice: past exam problems by chapter, with worked solutions · gatedaprep.com