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.
When was the Security Printing and Minting Corporation of India Limited established?
Which of the following is not true about Term Loans?
What kind of organizational structure combines a vertical chain of command with horizontal reporting requirements?
Which of the following credit facilities is demandable at any time by the bank?
Premium amount of and minimum age of entry in PM Suraksham Bima Yojna?
In 2008, India launched the National Action Plan on Climate Change (NAPCC), establishing _________ National Missions, covering several initiatives and a...
IFSCA has recently issued 6) Guidelines for Business Continuity Plan (BCP) and Disaster Recovery (DR) for Market Infrastructure institutions (MIIs), how...
Which of the following behaviors is NOT typically associated with transformational leadership?
What is the financial allocation for women-related schemes in the Union Budget 2024-25?
Which of the following is NOT a factor that typically contributes to high employee morale?