Sorting backtracking algorithm
Added comments