Abstract
We study algorithmic aspects of the Path puzzle--a logic puzzle created in 2013 and confirmed NP-complete (Non-deterministic Polynomial-time-complete) in 2020. We propose a polynomial time algorithm for verifying an arbitrary Path puzzle solution and a backtracking-based method for finding a solution to an arbitrary Path puzzle instance.To our knowledge, our study is the first rigorous investigation of an imperative algorithmic approach for solving Path puzzles. We prove that the asymptotic running time of our proposed method in solving an arbitrary Path puzzle instance of size $m \times n$ is $O(3^{mn})$. Despite this exponential upper bound, experimental results imply that a C++ implementation of our algorithm can quickly solve $6 \times 6$ Path puzzle instances in less than 30 milliseconds with an average of 3.02 milliseconds for 26 test cases. We finally prove that an $m \times n$ Path puzzle instance without row and column constraints is polynomially solvable in $O(\max\{m,n\})$ time.
Published Version (Free)
Talk to us
Join us for a 30 min session where you can share your feedback and ask us any queries you have
More From: Journal of Fundamental Mathematics and Applications (JFMA)
Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.