Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this project, you will write a Java program that uses recursion to find all solutions to the n-Queens problem, for 1 15. There are

In this project, you will write a Java program that uses recursion to find all solutions to the n-Queens problem, for 1 15.

There are 4 functions that must be used:

static void placeQueen(int[][] B, int i, int j)

static void removeQueen(int[][] B, int i, int j)

static void printBoard(int[][] B)

static int findSolutions(int[][] B, int i, String mode)

I'd like this solved and tested ASAP, thank you.

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

CMPS 12B Introduction to Data Structures Programming Assignment 2 In this project, you will write a Java program that uses recursion to find all solutions to the n-Queens problem, for 1 n (a queen was placed on row n, and hence a solution was found) 2.if we are in verbose mode print that solution return 1 4 5. else for each square on row i if that square is safe 7. place a queen on that square recur on row (i + 1), then add the return value to an accumulating sum remove the queen from that square 10 11. return the accumulated sum Your program's function main ) will read the command line arguments, and determine the value of n, and what mode (normal or verbose) to run in. It will initialize an int array of size (n + 1) x (n + 1) to all zeros, call function findSolutions () on this array in the correct mode, then print out the number of solutions to n-queens that were found. What to turn in Write a Makefile for this project that creates an executable Jar file called Queens, and that includes a clean target (as in lab1). Submit the files Makefile and Queens.java to the assignment name pa2. As always start early and ask questions in lab sessions and on Piazza

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases Demystified

Authors: Andrew Oppel

1st Edition

0072253649, 9780072253641

More Books

Students also viewed these Databases questions

Question

complete the following dH dA %3D dn, dn

Answered: 1 week ago

Question

discuss the reliability of the data you have gathered;

Answered: 1 week ago

Question

undertake an initial analysis of your data;

Answered: 1 week ago