Log in to add a comment

Log in to add a comment

1. A BFS searches every single solution in a graph to expand its nodes; a DFS burrows deep within a child node until a goal is reached.

2. The features of a BFS are space and time complexity, completeness, proof of completeness, and optimality; the most natural output for a DFS is a spanning tree with three classes: forward edges, back edges, and cross edges.

In DFS we explore the root node and traverse as far as possible from the root node untill the goal is achived.

2.In BFS the space complexity is more critical as compared to time complexity. while

In DFS has lesser space complexity, because at a time it needs to store only single path from the root to leaf node.

3.Breadth First Search can be done with the help of queue i.e, FIFO(First In First Out) while

Depth First Search can be done with the help of stack i.e. LIFO(Last In First Out).

4.BFS is slower than DFS while

DFS is more faster than BFS.

5.BFS requires more memory compare to DFS while

DFS require less memory compare to BFS.

6.BFS is useful in finding shortest path while

DFS in not so useful in finding shortest path.