Graph Algorithms

Your answer
Answer & solution
Answer: C (no official key was published)
1. Maintain a visited flag for each vertex. Start a BFS/DFS at every vertex not yet visited and increment a component counter.
2. Each search visits precisely one previously unvisited component. Across all searches each vertex is processed once and each undirected edge twice.
3. With adjacency lists the total is Θ(n+m), C. The n term includes isolated vertices; an adjacency-matrix representation instead requires Θ(n²).