1, the same point:
Backtracking is also in the implementation of depth-first, that is, step-by-step exploration, and not like the breadth first, from near a piece of land sweep.
2, different points
(1) Access order
Depth-First traversal:
The purpose is "traversal", which is essentially unordered. This means that the order of access is not important, and it is important to have been visited.
Refer to the title surrounded regions, the depth first only need to get the "O" from the boundary to all access.
Therefore, in the implementation, it is sufficient for each location record to be visited.
Backtracking method:
The aim is to "solve the process", the essence is orderly. In other words, each step must be a required order.
You can refer to Word Search, which requires a deep first exploration in order of requirements, and must be met at every step.
Therefore, in the implementation, visited records cannot be used, because different sequential accesses of the same content will result in different results, rather than simply being "accessed".
To use Access state to record, that is, for each point record has visited the direction of the neighbor, after backtracking back to the new direction to access the neighbor.
It is not important to have been visited before this point, and it is important not to access it in the current order.
(2) Number of visits
Depth-First traversal: a node that has been visited is no longer accessible, and all points are accessed only once.
Backtracking: Points that have been visited may be accessed again, or there may be points that have not been visited.
Similarities and differences between "algorithm" backtracking method and depth-first traversal