The most efficient algorithm for finding the number of connected components in an undirected graph on $n$ vertices and $m$ edges has time complexity
Run DFS to find connected components. Its time complexity is $\Theta(m+n)$, hence (C) is the answer.
The explanation of this ans can be find in :
see first 15 minuets portion
@Vivek Jain can you explain how to use disjoint sets?? I'm not getting what is your approach??
According to me it should be O(m+n) by using dfs or bfs.