An undirected graph G with n vertices and e edges is represented by adjacency list. What is the time required to generate all the connected components?
A. O(n)
B. O(e)
C. O(e+n)
D. O(e2)
Answer:C
An undirected graph G with n vertices and e edges is represented by adjacency list. What is the time required to generate all the connected components?
A. O(n) B. O(e) C. O(e+n) D. O(e2)