回溯和深度优先搜索有什么区别?

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

回溯和深度优先搜索之间有什么区别?

What's the difference between backtracking and depth first search?

推荐答案

回溯是一种更通用的算法。

Backtracking is a more general purpose algorithm.

深度优先搜索是与搜索树结构相关的回溯的一种特殊形式。从Wikipedia:

Depth-First search is a specific form of backtracking related to searching tree structures. From Wikipedia:

一个从根开始(在图例中选择某个节点作为根),并沿着每个根尽可能地探索

One starts at the root (selecting some node as the root in the graph case) and explores as far as possible along each branch before backtracking.

它使用回溯作为处理树的一部分,但仅限于树结构。

It uses backtracking as part of its means of working with a tree, but is limited to a tree structure.

回溯可用于可以消除部分域的任何类型的结构-无论它是否是逻辑树。 Wiki示例使用一个棋盘和一个特定的问题-您可以查看一个特定的动作,并消除它,然后回溯到下一个可能的动作,消除它,等等。

Backtracking, though, can be used on any type of structure where portions of the domain can be eliminated - whether or not it is a logical tree. The Wiki example uses a chessboard and a specific problem - you can look at a specific move, and eliminate it, then backtrack to the next possible move, eliminate it, etc.

更多推荐

回溯和深度优先搜索有什么区别?

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

发布评论

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

>www.elefans.com

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