Question

What is the difference between 'BFS' (Breadth-First Search) and 'DFS' (Depth-First Search) in graph traversal?

A BFS uses a stack; DFS uses a queue
B BFS is used only for traversing trees; DFS is used only for traversing graphs
C BFS explores all neighbours at the current depth level before going deeper; DFS explores along each branch before backtracking
D BFS always finds the shortest path in weighted graphs; DFS finds the longest path in weighted graphs
E BFS and DFS produce identical traversal results on all graphs
Practice Next

Relevant for Exams:

Hey! Ask a query