The following gives the backtracking algorithm in pseudo-code for a constraint satisfaction problem, where U is…

The following gives the backtracking algorithm in pseudo-code for a constraint satisfaction problem, where U is a set of unassigned variables, and A is the current partial assignment search(U,A) if (U) return A; remove a variable X from U; for (each value a in X’s domain) if (X-a is consistent with A) add X=a to A; res – search(U,A) if res !# false return res remove X=a from A; return false; A magic square of size N is an N x N square grid filled with distinct numbers from 1 to N2 such that the numbers in each row, in each column, as wel as the numbers in the main and secondary diagonals, all add up to the same value. Based on the above algorithm, write a program in C++ or Java to find a 3 _3 magic square