Skip to content

To Fix maze recursion boundary validation with code improvements - #7672

Merged
alxkm merged 21 commits into
TheAlgorithms:masterfrom
NithinU2802:fix/maze-recursion-boundary-validation
Nov 7, 2026
Merged

alxkm merged 21 commits into
TheAlgorithms:masterfrom
NithinU2802:fix/maze-recursion-boundary-validation

Conversation

@NithinU2802

@NithinU2802 NithinU2802 commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

This PR solves,

  • Fixed the maze solver so it checks maze boundaries instead of trying to access cells outside the maze. The existing methods keep their current start and destination, and now return null if those positions don't fit the maze.
  • Added overloads that let callers provide start and destination coordinates, along with checks for invalid coordinates and malformed mazes.
  • Added tests for small mazes, both search strategies, invalid coordinates, and mazes with no path.
  • Did code improvement to avoid duplication.

Closes #7671

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized it.
  • All filenames are in PascalCase.
  • All functions and variable names follow Java naming conventions.
  • All new algorithms have a URL in their comments that points to Wikipedia or other similar explanations.
  • All new algorithms include a corresponding test class that validates their functionality.
  • All new code is formatted with clang-format -i --style=file path/to/your/file.java

@codecov-commenter

codecov-commenter commented Oct 28, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.22222% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 82.35%. Comparing base (8b19b87) to head (e1c84ff).

Files with missing lines Patch % Lines
.../com/thealgorithms/backtracking/MazeRecursion.java 97.22% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #7672      +/-   ##
============================================
+ Coverage     82.28%   82.35%   +0.06%     
- Complexity     8414     8446      +32     
============================================
  Files           843      843              
  Lines         26150    26154       +4     
  Branches       5104     5108       +4     
============================================
+ Hits          21518    21538      +20     
+ Misses         3842     3829      -13     
+ Partials        790      787       -3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@alxkm alxkm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Thank you for the contribution.

@alxkm
alxkm merged commit 1e59594 into TheAlgorithms:master Nov 7, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] MazeRecursion crashes on small mazes

3 participants