0
要启动反向跟踪算法,可以为i = 0调用以下伪代码; X [1..0]表示空元组。了解伪代码用于反向跟踪算法
ALGORITHM Backtrack(X[1..i])
//Gives a template of a generic backtracking algorithm
//Input: X[1..i] specifies first i promising components of a solution.
//Output: Alll the tuples representing the problem's solutions
If X[1..i] is a solution write X[1..i]
else
for each element x belongs to Si+1 consistent with X[1..i] and constraints do
X[i+1] <- x
Backtrack(X[1..i+1])
我很难理解上面的逻辑。我试图用步骤来解决4皇后问题,但不是。请用你的帮助理解以上逻辑与4皇后问题的步骤。
谢谢!