Question
Which traversal method is most suitable for finding
connected components in an undirected graph?Solution
Depth-First Search (DFS) is ideal for finding connected components in an undirected graph. Starting from an unvisited vertex, DFS explores all reachable vertices, marking them as visited. Each DFS call identifies one connected component, and the process is repeated for all unvisited vertices. Steps: 1. Initialize all vertices as unvisited. 2. Perform DFS from each unvisited vertex. 3. Each DFS traversal marks a connected component. DFS is efficient, with a time complexity of O(V+E), making it well-suited for sparse and dense graphs. Why Other Options Are Incorrect: 1. BFS: Can also find connected components but requires more memory due to queue-based implementation. 2. Topological Sort: Applies to Directed Acyclic Graphs (DAGs) and does not determine connected components. 3. Dijkstra’s Algorithm: Finds shortest paths, not connected components. 4. Floyd-Warshall Algorithm: Computes all-pairs shortest paths, unsuitable for this task.
Consider the following statements about ozone layer:
1. It protects us from UV rays.
2. It is found in the troposphere.
3. CFCs are harmful to it.
Which state was declared India’s first fully literate state in 2025?
- Which article of the Indian Constitution addresses the Governor's Pardoning Power?
Who was re-appointed as the Managing Director and CEO of Central Depository Services (India) Limited (CDSL) in August 2024?
Which of the following is NOT an advantage of privatization?
Which ministries collaborated to organize the Veer Gatha 3.0 event in New Delhi?
Which state has the country’s first Graphene Innovation Centre?
AU Small Finance Bank has partnered with Mastercard for the official launch of the Mastercard Debit Card, specifically catering to the bank's corporate ...
When is 'World Water Day' celebrated every year to highlight the importance of water?
Which ministry will implement the PM Vidyalaxmi scheme?