Question: Also give pseudo code of backtracking algorithm for n queens problem that uses modified canPlace function. Roll #: Q2) Recall that the canPlace(X, n, k,

Also give pseudo code of backtracking algorithm for n queens problem that uses modified canPlace function.
Roll #: Q2) Recall that the canPlace(X, n, k, j) fuction of n Queens problem returns true if k+1 queen can be placed at column j and false otherwise. This solution can be more efficient if canPlace is modified such that it returns the column number at which the k+1 queen can be placed instead of just returning true or false, (15 Marks Write down the pseudo code of modified canPlace function that take partial solution vector X, n (total number of queens), k (number of queens placed so far) and column j. This modified function should return the next legitimate column from j onwards and if any such column exists. Otherwise it should return 0. [8 Marks]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
