procedure bacaktrace(n)
k = 1;
while (k>0) do
if Tk (x1,x2,...,xk-1)的值还未取遍 Then
{xk = Tk(x1,x2,...xK-1)中未取遍的值;
if Bk (x1,x2,...,xk) then
{(x1,x2,...xk)被激活;
if k == n then 输出(x1,x2,....xn);
else k = k+1; //深度扩展搜索
}
}
else k = k-1 //试探完了所有的x k ,回溯
end bacaktrace