Skip to content
StackDecode
BacktrackingExplained

Knight's Tour

Visit every square once with knight moves.

Time

O(8^(n²))

Extra space

O(n²)

Use it for

Hamiltonian path on a chessboard.

An animated walkthrough for this algorithm isn’t built yet. The summary above explains the idea; see the related animated algorithms below to practise the same technique.