Question

What is the primary difference between a breadth-first search (BF

  • S and a depth-first search (DF
  • S in graph traversal?
A BFS visits nodes in ascending order of their values, while DFS visits nodes in descending order.
B BFS always finds the shortest path, while DFS does not guarantee finding the shortest path.
C BFS uses a stack, while DFS uses a queue.
D BFS cannot be applied to graphs.
Practice Next

Relevant for Exams:

Hey! Ask a query