Ad here

Monday, April 13, 2015

BFS ( Breadth First Search ) Versus ( DFS Depth First Search )


  BFS ( Breadth First Search )      Versus   DFS ( Depth First Search )


1. Solution will definitely found out by BFS If there are some solution. 
2. BFS will never get trapped in blind alley , means unwanted nodes.
3. If there are more than one solution then it will find solution with minimal steps.

1. Memory Constraints As it stores all the nodes of present level to go for next level.
2. If solution is far away then it consumes time.

1.Finding Shortest Path.
2.Checking graph with bipertiteness.
3.Copying cheiney's Algorithm.

1. Memory requirement is Linear WRT Nodes.
2. Less time and space complexity rather than BFS.
3. Solution can be found out by without much more search.

1. Not Guaranteed that it will give you solution.
2. Cut-off depth is smaller so time complexity is more.
3. Determination of depth until the search has proceeds.

1. Finding Connected components.
2. Topological sorting.
3. Finding Bridges of graph.

No comments:

Post a Comment