SlideShare una empresa de Scribd logo
1 de 11
NADAR COLLEGE OF ARTS AND SCIENCE
8 QUEEN PROBLEMS USING BACKTRACKING
NAME:P.RITHIKA
CLASS:I-M.SC(IT)
8 QUEEN PROBLEMS USING BACKTRACKING:
• You are given an 8x8 chessboard, find a way to place 8 queens such that no queen can attack
any other queen on the chessboard.
• A queen can only be attacked if it lies on the same row, or same column, or the same diagonal
of any other queen.
• The backtracking algorithm, in general checks all possible configurations and test whether
the required result is obtained or not.
• The solution will be correct when the number of placed queens = 8 The time complexity of
this approach is O(N!).
INPUT ANDOUTPUT FORMAT :
•The number 8, which does not need to be read, but
we will take an input number for the sake of
generalization of the algorithm to an NxN
chessboard.
•All matrices that constitute the possible solutions will
contain the numbers 0(for empty cell) and 1(for a cell
where queen is placed). Hence, the output is a set of
binary matrices.
4×4 CHESSBOARD :
•In this configuration, we place 2 queens in the
first iteration and see that checking by placing
further queens is not required as we will not get a
solution in this path. Note that in this
configuration, all places in the third rows can be
attacked.
•As the above combination was not
possible, we will go back and go for the
next iteration. This means we will change
the position of the second queen.
• In this, we found a solution.Now let’s take a look at the
backtracking algorithm and see how it works:
• The idea is to place the queens one after the other in columns,
and check if previously placed queens cannot attack the current
queen we’re about to place.
• If we find such a row, we return true and put the row and
column as part of the solution matrix. If such a column does
not exist, we return false and backtrack*
• 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
OUTPUT ( FOR N = 4): 1 INDICATES
PLACEMENT OF QUEENS
•THANK YOU

Más contenido relacionado

Similar a DATA STRUCTURE AND ALGORITHM

Requirements Use JavaDo Not Use RecursionDo Not Use Array Lis.pdf
Requirements Use JavaDo Not Use RecursionDo Not Use Array Lis.pdfRequirements Use JavaDo Not Use RecursionDo Not Use Array Lis.pdf
Requirements Use JavaDo Not Use RecursionDo Not Use Array Lis.pdfalphaagenciesindia
 
7.6 Solving Systems with Gaussian Elimination
7.6 Solving Systems with Gaussian Elimination7.6 Solving Systems with Gaussian Elimination
7.6 Solving Systems with Gaussian Eliminationsmiller5
 
Backtrack search-algorithm
Backtrack search-algorithmBacktrack search-algorithm
Backtrack search-algorithmRuchika Sinha
 
9.3 Solving Systems With Gaussian Elimination
9.3 Solving Systems With Gaussian Elimination9.3 Solving Systems With Gaussian Elimination
9.3 Solving Systems With Gaussian Eliminationsmiller5
 
Backtracking-N Queens Problem-Graph Coloring-Hamiltonian cycle
Backtracking-N Queens Problem-Graph Coloring-Hamiltonian cycleBacktracking-N Queens Problem-Graph Coloring-Hamiltonian cycle
Backtracking-N Queens Problem-Graph Coloring-Hamiltonian cyclevarun arora
 
Sorting-algorithmbhddcbjkmbgjkuygbjkkius.pdf
Sorting-algorithmbhddcbjkmbgjkuygbjkkius.pdfSorting-algorithmbhddcbjkmbgjkuygbjkkius.pdf
Sorting-algorithmbhddcbjkmbgjkuygbjkkius.pdfArjunSingh81957
 
data structures- back tracking
data structures- back trackingdata structures- back tracking
data structures- back trackingAbinaya B
 
Topic Use stacks to solve Maze. DO NOT USE RECURSION. And do not us.pdf
Topic Use stacks to solve Maze. DO NOT USE RECURSION. And do not us.pdfTopic Use stacks to solve Maze. DO NOT USE RECURSION. And do not us.pdf
Topic Use stacks to solve Maze. DO NOT USE RECURSION. And do not us.pdfambikacollection1084
 
Genetic operators
Genetic operatorsGenetic operators
Genetic operatorsDEEPIKA T
 
Solution of N Queens Problem genetic algorithm
Solution of N Queens Problem genetic algorithm  Solution of N Queens Problem genetic algorithm
Solution of N Queens Problem genetic algorithm MohammedAlKazal
 
need help with this java lab please read below and follow the steps.pdf
need help with this java lab please read below and follow the steps.pdfneed help with this java lab please read below and follow the steps.pdf
need help with this java lab please read below and follow the steps.pdfarjuntiwari586
 
Lecture 3 Inverse matrices(hotom).pdf
Lecture 3 Inverse matrices(hotom).pdfLecture 3 Inverse matrices(hotom).pdf
Lecture 3 Inverse matrices(hotom).pdfSakith1
 
chapter7_Sec1.ppt
chapter7_Sec1.pptchapter7_Sec1.ppt
chapter7_Sec1.pptvinnisart
 
Rank, Nullity, and Fundamental Matrix Spaces.pptx
Rank, Nullity, and Fundamental Matrix Spaces.pptxRank, Nullity, and Fundamental Matrix Spaces.pptx
Rank, Nullity, and Fundamental Matrix Spaces.pptxfroilandoblon1
 

Similar a DATA STRUCTURE AND ALGORITHM (20)

Requirements Use JavaDo Not Use RecursionDo Not Use Array Lis.pdf
Requirements Use JavaDo Not Use RecursionDo Not Use Array Lis.pdfRequirements Use JavaDo Not Use RecursionDo Not Use Array Lis.pdf
Requirements Use JavaDo Not Use RecursionDo Not Use Array Lis.pdf
 
7.6 Solving Systems with Gaussian Elimination
7.6 Solving Systems with Gaussian Elimination7.6 Solving Systems with Gaussian Elimination
7.6 Solving Systems with Gaussian Elimination
 
8 queen problem
8 queen problem8 queen problem
8 queen problem
 
Backtrack search-algorithm
Backtrack search-algorithmBacktrack search-algorithm
Backtrack search-algorithm
 
9.3 Solving Systems With Gaussian Elimination
9.3 Solving Systems With Gaussian Elimination9.3 Solving Systems With Gaussian Elimination
9.3 Solving Systems With Gaussian Elimination
 
Backtracking-N Queens Problem-Graph Coloring-Hamiltonian cycle
Backtracking-N Queens Problem-Graph Coloring-Hamiltonian cycleBacktracking-N Queens Problem-Graph Coloring-Hamiltonian cycle
Backtracking-N Queens Problem-Graph Coloring-Hamiltonian cycle
 
matrices_and_loops.pptx
matrices_and_loops.pptxmatrices_and_loops.pptx
matrices_and_loops.pptx
 
Sorting-algorithmbhddcbjkmbgjkuygbjkkius.pdf
Sorting-algorithmbhddcbjkmbgjkuygbjkkius.pdfSorting-algorithmbhddcbjkmbgjkuygbjkkius.pdf
Sorting-algorithmbhddcbjkmbgjkuygbjkkius.pdf
 
data structures- back tracking
data structures- back trackingdata structures- back tracking
data structures- back tracking
 
Topic Use stacks to solve Maze. DO NOT USE RECURSION. And do not us.pdf
Topic Use stacks to solve Maze. DO NOT USE RECURSION. And do not us.pdfTopic Use stacks to solve Maze. DO NOT USE RECURSION. And do not us.pdf
Topic Use stacks to solve Maze. DO NOT USE RECURSION. And do not us.pdf
 
Genetic operators
Genetic operatorsGenetic operators
Genetic operators
 
Solution of N Queens Problem genetic algorithm
Solution of N Queens Problem genetic algorithm  Solution of N Queens Problem genetic algorithm
Solution of N Queens Problem genetic algorithm
 
Backtracking
BacktrackingBacktracking
Backtracking
 
need help with this java lab please read below and follow the steps.pdf
need help with this java lab please read below and follow the steps.pdfneed help with this java lab please read below and follow the steps.pdf
need help with this java lab please read below and follow the steps.pdf
 
Nsm
Nsm Nsm
Nsm
 
Lecture 3 Inverse matrices(hotom).pdf
Lecture 3 Inverse matrices(hotom).pdfLecture 3 Inverse matrices(hotom).pdf
Lecture 3 Inverse matrices(hotom).pdf
 
chapter7_Sec1.ppt
chapter7_Sec1.pptchapter7_Sec1.ppt
chapter7_Sec1.ppt
 
Rank, Nullity, and Fundamental Matrix Spaces.pptx
Rank, Nullity, and Fundamental Matrix Spaces.pptxRank, Nullity, and Fundamental Matrix Spaces.pptx
Rank, Nullity, and Fundamental Matrix Spaces.pptx
 
Me314 week09-root locusanalysis
Me314 week09-root locusanalysisMe314 week09-root locusanalysis
Me314 week09-root locusanalysis
 
Slide_Chapter1_st.pdf
Slide_Chapter1_st.pdfSlide_Chapter1_st.pdf
Slide_Chapter1_st.pdf
 

Más de rithika858339

data mining and Whorehousing.pptx
data mining and Whorehousing.pptxdata mining and Whorehousing.pptx
data mining and Whorehousing.pptxrithika858339
 
distribute computing.pptx
distribute computing.pptxdistribute computing.pptx
distribute computing.pptxrithika858339
 
fault tolerance1.pptx
fault tolerance1.pptxfault tolerance1.pptx
fault tolerance1.pptxrithika858339
 
artificial intelligence.pptx
artificial intelligence.pptxartificial intelligence.pptx
artificial intelligence.pptxrithika858339
 
artificial intelligence.pptx
artificial intelligence.pptxartificial intelligence.pptx
artificial intelligence.pptxrithika858339
 
Network information security
Network information securityNetwork information security
Network information securityrithika858339
 
Advance computer architecture
Advance computer architectureAdvance computer architecture
Advance computer architecturerithika858339
 
Data structure and algorithm
Data structure and algorithmData structure and algorithm
Data structure and algorithmrithika858339
 
Network and information security
Network and information securityNetwork and information security
Network and information securityrithika858339
 
Network and information security
Network and information securityNetwork and information security
Network and information securityrithika858339
 
Network and information security
Network and information securityNetwork and information security
Network and information securityrithika858339
 
General method in backtracking
General method in backtrackingGeneral method in backtracking
General method in backtrackingrithika858339
 

Más de rithika858339 (20)

data mining and Whorehousing.pptx
data mining and Whorehousing.pptxdata mining and Whorehousing.pptx
data mining and Whorehousing.pptx
 
distribute computing.pptx
distribute computing.pptxdistribute computing.pptx
distribute computing.pptx
 
clustering.pptx
clustering.pptxclustering.pptx
clustering.pptx
 
fault tolerance1.pptx
fault tolerance1.pptxfault tolerance1.pptx
fault tolerance1.pptx
 
python.pptx
python.pptxpython.pptx
python.pptx
 
artificial intelligence.pptx
artificial intelligence.pptxartificial intelligence.pptx
artificial intelligence.pptx
 
artificial intelligence.pptx
artificial intelligence.pptxartificial intelligence.pptx
artificial intelligence.pptx
 
python.pptx
python.pptxpython.pptx
python.pptx
 
Network information security
Network information securityNetwork information security
Network information security
 
ACA
ACAACA
ACA
 
DSA
DSADSA
DSA
 
CD-1.pptx
CD-1.pptxCD-1.pptx
CD-1.pptx
 
Java JSP.pptx
Java JSP.pptxJava JSP.pptx
Java JSP.pptx
 
CD
CDCD
CD
 
Advance computer architecture
Advance computer architectureAdvance computer architecture
Advance computer architecture
 
Data structure and algorithm
Data structure and algorithmData structure and algorithm
Data structure and algorithm
 
Network and information security
Network and information securityNetwork and information security
Network and information security
 
Network and information security
Network and information securityNetwork and information security
Network and information security
 
Network and information security
Network and information securityNetwork and information security
Network and information security
 
General method in backtracking
General method in backtrackingGeneral method in backtracking
General method in backtracking
 

Último

From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 

Último (20)

From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 

DATA STRUCTURE AND ALGORITHM

  • 1. NADAR COLLEGE OF ARTS AND SCIENCE 8 QUEEN PROBLEMS USING BACKTRACKING NAME:P.RITHIKA CLASS:I-M.SC(IT)
  • 2. 8 QUEEN PROBLEMS USING BACKTRACKING: • You are given an 8x8 chessboard, find a way to place 8 queens such that no queen can attack any other queen on the chessboard. • A queen can only be attacked if it lies on the same row, or same column, or the same diagonal of any other queen. • The backtracking algorithm, in general checks all possible configurations and test whether the required result is obtained or not. • The solution will be correct when the number of placed queens = 8 The time complexity of this approach is O(N!).
  • 3. INPUT ANDOUTPUT FORMAT : •The number 8, which does not need to be read, but we will take an input number for the sake of generalization of the algorithm to an NxN chessboard. •All matrices that constitute the possible solutions will contain the numbers 0(for empty cell) and 1(for a cell where queen is placed). Hence, the output is a set of binary matrices.
  • 4. 4×4 CHESSBOARD : •In this configuration, we place 2 queens in the first iteration and see that checking by placing further queens is not required as we will not get a solution in this path. Note that in this configuration, all places in the third rows can be attacked.
  • 5.
  • 6. •As the above combination was not possible, we will go back and go for the next iteration. This means we will change the position of the second queen.
  • 7.
  • 8. • In this, we found a solution.Now let’s take a look at the backtracking algorithm and see how it works: • The idea is to place the queens one after the other in columns, and check if previously placed queens cannot attack the current queen we’re about to place. • If we find such a row, we return true and put the row and column as part of the solution matrix. If such a column does not exist, we return false and backtrack*
  • 9. • 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
  • 10. OUTPUT ( FOR N = 4): 1 INDICATES PLACEMENT OF QUEENS