hey guys ,

I am trying to solve 8-queens problem using backtracking. Here is my algo.
Could someone please tell me what is wrong in this code??

bool queen(int p,int count , int position[][])
{
  if(count == 8)  return true;

  for(int i=p,i<8;i++)
    for(int j=0;j<8;j++)
        if(marked(i,j) == false )   // finding secure position on board
         {
            markboard(i,j);            // if found any secure position then
mark all board positions which are in range of queen.
            position[count][count]={i,j};   //save position for final answer
            count++;
            if(queen(p+1,count,position[][]) == true)
              return true;
         }
}

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to