Q. Which algorithm is best suited for finding connected components in a graph?
-
A.
BFS
-
B.
DFS
-
C.
Dijkstra's Algorithm
-
D.
A* Search
Solution
DFS is often used to find connected components in a graph by exploring all reachable nodes from a starting node.
Correct Answer:
B
— DFS
Learn More →
Q. Which of the following statements about BFS and DFS is false?
-
A.
BFS can find the shortest path in unweighted graphs
-
B.
DFS can be more memory efficient than BFS
-
C.
BFS uses a stack
-
D.
DFS can be implemented recursively
Solution
BFS uses a queue, not a stack, which is a key difference from DFS.
Correct Answer:
C
— BFS uses a stack
Learn More →
Showing 1 to 2 of 2 (1 Pages)