need executable programming code which gives the solution where the next k th queen 5152741
Need executable programming code which gives the solution where the next K-th queen can be placed in the next column instead of returning TRUE or FALSE. It will be helpul if you can give README file as well
1. Algorithm NQueens canbe made more efficient by redefining the func- tion Place(k, i) so that it either returns the next legitimate column on which to place the kth queen or an illegal value. Rewrite both functions (Algorithms 7.4 and 7.5) so they implement this alternate strategy Algorithm Place (k, i) 1 2 // Returns true if a queen can be placed in kth row and /ith column. Otherwise it returns false. [ ] is 3 a // global array whose first (k – 1) values have been set 4 // Abs(r) returns the absolute value of r. 5 6 for j1 to k- 1 do 7 if ((ji/ Two in the same column (Abs(j] //or in the same diagonal then return false; 8 i) = Abs(j k))) 9 10 11 12 or return true; 13 Algorithm 7.4 Can a new queen be placed? Algorithm NQueens(k, n) 2 1 //Using backtracking, this procedure prints all /possible placements of n queens on an n X n 4 3 //chessboard so that they are nonattacking 5 for i= 1 to n do { if Place(k, i) then { rk]=i; if (k n) then write (x[1 : n]); else NQueens(k + 1,n); } 6 7 9 10 11 12 13 14 15 } Algorithm 7.5 All solutions to the n-queens problem