In this chapter, we learn the technique called backtrackingBacktracking. Backtracking is a systematic method of trial and error. In short, it is an approach that tests all possible choices, looking for the desired solution. Up to this point, it is similar to the DFS and BFS algorithms discussed in Chap. 4 , and, like these algorithms, checks in the search tree systematically in order. The main feature of backtracking is that, if it finds at some point that there is no possibility of finding a solution, it halts the search, returns to the last branch, and turns to the next choice that has not yet been tested. This trick—return and turn to the next choice—is the reason why this method is called “backtracking.” If we can halt the redundant searching, even if the search tree is huge, we may find a solution efficiently.

错误:搜索内容不能为空,请输入英文关键词
错误:关键词超出字数限制,请精简
高级检索

Backtracking

  • Ryuhei Uehara

摘要

In this chapter, we learn the technique called backtrackingBacktracking. Backtracking is a systematic method of trial and error. In short, it is an approach that tests all possible choices, looking for the desired solution. Up to this point, it is similar to the DFS and BFS algorithms discussed in Chap. 4 , and, like these algorithms, checks in the search tree systematically in order. The main feature of backtracking is that, if it finds at some point that there is no possibility of finding a solution, it halts the search, returns to the last branch, and turns to the next choice that has not yet been tested. This trick—return and turn to the next choice—is the reason why this method is called “backtracking.” If we can halt the redundant searching, even if the search tree is huge, we may find a solution efficiently.