knights tour

Introduction
This post is a continuation of the back tracking series. You can refer to other similar posts here. In this post we will be discussing the Knight's Tour Problem. The problem states that, given a N * M chessboard, a Knight's Tour is defined as the sequence of moves of a Knight, such that the Knight visits every square only once.
Does this sound similar?
Yes it is similar to finding the Hamiltonian Path as defined in this post.
Approach for solving the Knight's Tour problem
Here I define the backtracking approach to solve this problem. Let the Knight start from any location...