3 ms·
Yes, backtracking is similar to depth-first search, except backtracking stop going down a branch as soon as you realize it's not going to work. Depth-first sea
by kens 16y ago
Yes, backtracking is similar to depth-first search, except backtracking stop going down a branch as soon as you realize it's not going to work. Depth-first search on the other hand normally visits all the nodes in the graph. Applied to the puzzle, depth-first search would try every possible combination of tiles and check each one to see if it works or not, which would be very inefficient.
Your peg-jumping puzzle would be harder to solve efficiently with backtracking, because it's not obvious until the end that you're on the wrong path. If you're interested in the mathematics of peg-jumping puzzles, see "Winning Ways for your mathematical plays, Vol 2", by Berlekamp, Conway, and Guy, which discusses the mathematics of the plus-shaped peg-jumping puzzle in detail.
- losvedir 16y agoThanks for the recommendation, I'll check it out!