listing the recursive function for solving the -queens problem def solvenqueensboardcol ) solution was found if -queens have been placed on the board if board numqueens(=board size(return true else find the next unguarded square within this column for row in rangeboard size()if board unguardedrowcol )place queen in that square board placequeenrowcol continue placing queens in the following columns if board solvenqueensboardcol+ we are finished if solution was found return true else no solution was found with the queen in this squareso it has to be removed from the board board removequeenrowcol if the loop terminatesno queen can be placed within this column return false implementing the adt having provided the recursive function for solving the -queens problemwe leave the implementation of the nqueens board adt as an exercise in this sectionhoweverwe discuss possible data structures for representing the actual board the most obvious choice is - array of size the elements of the array can contain boolean values with true indicating the placement of the queens to determine if given square is unguardedloops can be used to iterate over all of the squares to which queen can move from that position if queen is found in any of the squares searched during the loop iterationsthen we know the square is currently guarded by at least one queen the placement and removal of the queens is also quite easy to implement using the - array structure as an alternativewe can actually use - array consisting of elements consider the illustration in figure on the next pagewhich shows the abstract view of an board at the top and - array at the bottom used to represent the board each element of the - array corresponds to one column on the board the elements of the - array will contain row indices indicating the positions of the queens on the board since only one queen can be placed within given columnwe need only keep track of the row containing the queen in the column when determining if square is unguardedwe can iterate through the row and column indices for the preceding columns on the board from which the given square can be attacked by queen instead of searching for true value within the elements of - arraywe need only determine if the elements of the - array contain one of the row indices being examined consider the illustration in