# new session-17 - Backtracking Backtracking Eight Queens...

• 15

This preview shows page 1 - 4 out of 15 pages.

Backtracking

Subscribe to view the full document.

Backtracking : Eight Queens problem Given N x N chessboard, find a way to place N queens on chessboard such that none of the queen can attack other. A queen can move along the column, row and diagonal of the chess board. Analysis This is typical example of backtracking algorithm. So before solving this problem, first understand what is backtracking. Backtracking a problem solving approach which is closest to the brute force method. In this, we explore each path which may lead to solution, taking one decision at a time and as soon as we find that the path which selected does not lead to solution, we go back to the place where we tool most recent decision. At that place, we will explore other opportunities to go to different path, if available. If there are no option available, we go back further. We go back till the time we find alternate path to be followed or at the start. If we reach to start without finding any path reaching to solution, then there is no solution present, else we would have found it following one of the paths.
8 queens problem Backtracking is depth first traversal of path in graph where nodes are states of the solution and edge are between two states of solution only if one state can be reached from another state.

Subscribe to view the full document.

• Winter '12
• praveen
• Backtracking, Eight queens puzzle, Brute-force search, Queens Problem, Fixed- sized tuple

{[ snackBarMessage ]}

###### "Before using Course Hero my grade was at 78%. By the end of the semester my grade was at 90%. I could not have done it without all the class material I found."
— Christopher R., University of Rhode Island '15, Course Hero Intern

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern