现在的位置: 首页 > 综合 > 正文

回溯和DFS的区别

2018年05月24日 ⁄ 综合 ⁄ 共 516字 ⁄ 字号 评论关闭

Definition:

Backtracking is a general algorithm for finding all (or some) solutions to some computational problems, notably constraint satisfaction problems, that incrementally builds candidates to the solutions, and abandons each partial
candidate c ("backtracks") as soon as it determines that c cannot possibly be completed to a valid solution.

Depth-first search (DFS) is an algorithm for traversing or searching tree or graph data structures. One starts at the root (selecting some arbitrary node as the root in the case of a graph) and explores as far as possible along
each branch before backtracking.

抱歉!评论已关闭.