Accelerated Knight: An O(1) Algorithm for Computing Minimum Knight Moves on an n × n Chessboard

We present an O(1) time and O(1) space algorithm for computing the minimum number of knight moves between two squares on a finite n × n chessboard. Classical approaches use breadth-first search (BFS) and require O(n^2) time. Our algorithm exploits symmetry, a lowerbound threshold principle, and a parity adjustment to derive a closed-form solution. The only exceptions are a finite set of boundary cases near the corners and on boards of size at most 4×4, which are handled by a small lookup table. We prove correctness via a symmetry reduction, a lower-bound lemma, a complete infinite-board induction, and a finite-board boundary lemma. We validate the algorithm against BFS for all pairs on boards up to 50 × 50 and for random pairs on boards up to 1000 × 1000.

Authors

Publication Details

Journal
Zenodo (CERN European Organization for Nuclear Research)
Published
2026-10-17
DOI
https://doi.org/10.5281/zenodo.23429347
Primary Topic
Complexity and Algorithms in Graphs
Type
preprint
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
preprint

Accelerated Knight: An O(1) Algorithm for Computing Minimum Knight Moves on an n × n Chessboard

Masrur Sarar
Zenodo (CERN European Organization for Nuclear Research)
Complexity and Algorithms in Graphs
preprint

Accelerated Knight: An O(1) Algorithm for Computing Minimum Knight Moves on an n × n Chessboard

Masrur Sarar
preprint en

Abstract

We present an O(1) time and O(1) space algorithm for computing the minimum number of knight moves between two squares on a finite n × n chessboard. Classical approaches use breadth-first search (BFS) and require O(n^2) time. Our algorithm exploits symmetry, a lowerbound threshold principle, and a parity adjustment to derive a closed-form solution. The only exceptions are a finite set of boundary cases near the corners and on boards of size at most 4×4, which are handled by a small lookup table. We prove correctness via a symmetry reduction, a lower-bound lemma, a complete infinite-board induction, and a finite-board boundary lemma. We validate the algorithm against BFS for all pairs on boards up to 50 × 50 and for random pairs on boards up to 1000 × 1000.

Zenodo (CERN European Organization for Nuclear Research)
Complexity and Algorithms in Graphs
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.