My favorite algorithm which includes in Recursion and backtracking method is N Queen problem.I love this problem because it helped me to solve various other problem including "Sudoku". The solution for this problem typically easy one,There are three types of attacks for the Queen to each other
This can be achieved by,if i,j are the respective coordinates which represents x = i and y = j
There are three types of attack
1. a[i] == a[j] same column or row
2. (a[i] - a[j]) - (i-j) same major diagonal
3. (a[j]-a[i]) - (j-i) same minor diagonal
The code for this problem.
source Robert Sedgewick and Kevin Wayne N queen