In backtracking, i.e. the algorithm used for solving the n-queens problem, there are basically two ways to do the recursive call:
- copy the parent board to make a child board, modify the child board by placing a new queen, then do the recursive call on the child board.
- modify the board directly, do the recursive call, then undo the modification.
The second is preferred since it avoids the costly copy.
This choice is also present in other algorithms, like minimax on games.
Is there a name for pattern 2 as opposed to pattern 1?