Write down the module getPossibleNextPositions for the n Queens problem?

Algorithm 1 eightQueens(partialSolution)1: // Prints all solutions to the 8-Queens problem.2: input: current partialsolution3: output: prints all poss

Algorithm 1 eightQueens(partialSolution)
1: // Prints all solutions to the 8-Queens problem.
2: input: current partialsolution
3: output: prints all possible solutions to the 8-queens problem.
4: if (length(partialSolution) = 8) then
5: print partialSolution
6: else
7: possibleItems ← getPossibleNextPositions(partialSolution)
8: k ← 0
9: while (k < length(possibleItems)) do
10: add(possibleItems[k], partialSolution)
11: eightQueens(partialSolution)
12: delete(length(partialSolution)-1, partialSolution)
13: k ← k + 1
14: end while
15: end if

or:Algorithm 1 eightQueens(partialSolution)1: // Prints all solutions to the 8-Queens problem.2: input: current partialsolution3: output: prints all possible solutions to the 8-queens problem.4: if (length(partialSolution) = 8) then5: print partialSolution6: else7: possibleItems \u2190 getPossibleNextPositions(partialSolution)8: k \u2190 09: while (k < length(possibleItems)) do10: add(possibleItems[k], partialSolution)11: eightQueens(partialSolution)12: delete(length(partialSolution)-1, partialSolution)13: k \u2190 k + 114: end while15: end if

Tags:write,