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.
The accounting concept that assumes a business will continue to operate for the foreseeable future is called:
Which of the following types of companies are not permitted to set up operations in GIFT City's IFSC?
Which of the following is NOT a component of the expenditure approach to calculating Gross Domestic Product (GDP)?
Why is clear communication considered a conflict prevention strategy?
Which of the following principle of HRD, the top management defining the distribution of authorities and responsibilities to the subordinates so that a ...
Which of the following statements is not correct?
 As per FEMA maximun amount a resident individual can pay in India, for meeting of medical expense of a NRI close relative is __
What is the distinction between ethics and morality based on their scope?
Which of the following is not a subsidiary/associate company of SIDBI? Â
What recent amendment has the government made to the foreign direct investment (FDI) policy in the space sector?