Depth-first search Vs. Breadth-first search
DFS
|
BFS
|
1. Stack data structure LIFO.
|
1. Queue data structure FIFO.
|
2. Does have blind alley.
|
2. Does not have blind alley.
|
3. It does not take more space.
|
3. BFS takes more space.
|
4. Blind alley exist therefore, It may follow a single unfruitful path for a long time and terminate in a state that have no successor.
|
4. No Blind alley therefore, It will not get trapped when finding a solution.
|
5. Neither optimal nor complete.
|
5. BFS is optimal.
|
6. It stop after one solution, minimal solution may or may not be found.
|
6. It may find many solution if exist and also gives a minimal solution / min. no. of step, longer path will never be explore before shorter path
|
can u give this in detail please..............
ReplyDeletethis is great
ReplyDeleteits good..............
ReplyDelete