Implemented the Recursive Backtracking algorithm.