hii guys,
i am trying to to do N-queen problem in which i have a function Place(k,i) which returns true if a queen can b placed at the K'th row and i'th column but am facing problem in understanding the following algorithm
Place(k,i)
{
for j=1 to k-1 do
if((x[j]=i) or (abs(x[j]-i)=abs(j-k))
then return false;
return true;
}
here x is a global array whose k-1 values are set
especially i fail to visualise the same diagonal and same column checking in the if block... :(