GATE | GATE CS 2008 | Question 85
The most efficient algorithm for finding the number of connected components in an undirected graph on n vertices and m edges has time complexity
(C) &thetha;(m + n)
Explanation: Number of connected components in undirected graph can simply calculated by doing a BFS or DFS. The best possible time complexity of BFS and DFS is O(m + n).
Quiz of this Question
Attention reader! Don’t stop learning now. Practice GATE exam well before the actual exam with the subject-wise and overall quizzes available in GATE Test Series Course.
Learn all GATE CS concepts with Free Live Classes on our youtube channel.