Template Function ADS::nQueensIterative

Function Documentation

template<class F>
long ADS::nQueensIterative(int n, F &&f)

the placements of n queens by the iterative backtracking, with the stage k and the column V[ k ] of the queen of row k: V[ k ] goes to the next column not attacked, k goes on when one is found and back when the columns of row k are over; f( V ) on each, true to stop; the number found

Pre:

n >= 1

Post:

each solution admissible