Essay 1 2019-2-17

How to distinguish between bfs and dfs, the main difference between the two:

dfs: It is a brute force method to search out all paths (recursive layer by layer), that is, all solutions are included;

bfs: Suitable for optimal solution problems, such as the shortest path, because the solution obtained by bfs closest to the root of the tree must be optimal;

 

Guess you like

Origin blog.csdn.net/weixin_44067773/article/details/87471377