MayankBhakat's blog

By MayankBhakat, history, 3 days ago, In English

Can anyone explain me how to optimize the backtracking algorithm of Knight Tour so that it passes all the testcases. Also, where can I find detailed explanations and solutions to cses problems? I found a explanataion of graph problems by some guy in codeforces but I was unable to understand what I have to sort in the knight tour.

  • Vote: I like it
  • +5
  • Vote: I do not like it

»
3 days ago, # |
  Vote: I like it 0 Vote: I do not like it

A simple pruning that you can do is prioritizing going to adjacent spots that have less options. This should be enough, however do you want a more in depth explanation? I think you can figure out why this works