Answers for "8-queens problem can be solved by"

0

8-queens problem can be solved by

START
1. begin from the leftmost column
2. if all the queens are placed,
   return true/ print configuration
3. check for all rows in the current column
   a) if queen placed safely, mark row and column; and 
      recursively check if we approach in the current 
      configuration, do we obtain a solution or not
   b) if placing yields a solution, return true
   c) if placing does not yield a solution, unmark and 
      try other rows
4. if all rows tried and solution not obtained, return
   false and backtrack
END
Posted by: Guest on August-23-2020

Browse Popular Code Answers by Language