广度优先或深度优先搜索

编程入门 行业动态 更新时间:2024-10-11 11:16:47
本文介绍了广度优先或深度优先搜索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我知道这个算法的工作,但不能决定何时使用哪种算法?

I know how this algorithm works, but cant decide when to use which algorithm ?

有没有一些准则,其中一个比另一个或任何方面的考虑执行?

Are there some guidelines, where one better perform than other or any considerations ?

非常感谢。

推荐答案

如果你想找到最短的步数,或者如果你的树有无限的高度(或非常大),你应该先使用广度的解决方案。

If you want to find a solution with the shortest number of steps or if your tree has infinite height (or very large) you should use breadth first.

如果你有一个有限的树,要使用的内存量最小,那么你应该先使用深度遍历所有可能的解决方案。

If you have a finite tree and want to traverse all possible solutions using the smallest amount of memory then you should use depth first.

如果您正在寻找最好的棋招玩,你可以使用迭代深化这是一个组合两者。

If you are searching for the best chess move to play you could use iterative deepening which is a combination of both.

IDDFS结合深度优先搜索的空间效率和广度优先搜索的完整性(当分支因子是有限的)。

IDDFS combines depth-first search's space-efficiency and breadth-first search's completeness (when the branching factor is finite).

更多推荐

广度优先或深度优先搜索

本文发布于:2023-11-05 02:36:03,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1559681.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:广度   深度

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!