Question
Modify the Backtracking algorithm for the $n$ Queens problem (Algorithm 5.1) so that it produces only the solutions that are invariant under reflections or rotations.
Step 1
First, we need to understand the symmetries of the chessboard. There are 8 possible transformations for an nxn chessboard: identity, 90-degree rotation, 180-degree rotation, 270-degree rotation, horizontal reflection, vertical reflection, main diagonal reflection, Show more…
Show all steps
Your feedback will help us improve your experience
Adriano Chikande and 71 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
Write an algorithm that receives as input the $n \times n$ matrix $A$ and outputs the transpose $A^{T}$.
Algorithms
Introduction
Transcript
Watch the video solution with this free unlock.
EMAIL
PASSWORD