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.
Which among the following gases is necessary for the process of photosynthesis?
The Reserve Bank of India (RBI) in Dec, 2021 introduced a prompt corrective action (PCA) framework for large non-banking financial companies (NBFCs). Fi...
Expenditure of the government on health facilities, education and fixed-asset acquisition is termed as _________.
Which state cricket team clinched the Vijay Hazare Trophy title in 2021–22?
Planet that rotates clockwise:
Which State of India is located in the north of tropic of Cancer?
Which of the following books has been written by the Booker Prize winner Kiran Desai?
A financial assistance of ________ rupees will be given to the community health centres so that they can be strengthened to meet the standards of sanita...
The average weight of an adult human heart is about:
The Reserve Bank of India was established on April 1, 1935 in accordance with the provisions of the: