Q. What is the primary difference between BFS and DFS?
-
A.
BFS uses a stack, DFS uses a queue
-
B.
BFS explores nodes level by level, DFS explores as far as possible along a branch
-
C.
BFS is faster than DFS
-
D.
DFS is always more memory efficient than BFS
Solution
The primary difference is that BFS explores nodes level by level, while DFS explores as far as possible along a branch before backtracking.
Correct Answer:
B
— BFS explores nodes level by level, DFS explores as far as possible along a branch
Learn More →
Q. Which algorithm is typically used to find the shortest path in a weighted graph?
-
A.
BFS
-
B.
DFS
-
C.
Dijkstra's Algorithm
-
D.
Prim's Algorithm
Solution
Dijkstra's Algorithm is used to find the shortest path in a weighted graph.
Correct Answer:
C
— Dijkstra's Algorithm
Learn More →
Showing 1 to 2 of 2 (1 Pages)