Repository navigation
feat(searches): make verification repeatable for recursiveSearch (R45… - #45
Open
Sapna2007-sst wants to merge 1 commit into
Open
Sapna2007-sst wants to merge 1 commit into
Sapna2007-sst wants to merge 1 commit into
Conversation
…-T005) - Add state and dependency contract documentation to DepthFirstSearch Javadoc - Introduce dependency injection seam for visited list with default preserving backwards compatibility - Add clearVisited method for accumulator reset - Add regression tests verifying repeatability across isolated instances, sequential input isolation, smallest valid input (null node), ordinary input, and injected sink - Add automated verification check runner work/R45-T005/check.py and verification evidence
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This pull request ensures repeatable and deterministic verification for
DepthFirstSearch.recursiveSearch, establishes input and state isolation tests, documents the zero-external-dependency contract, and adds a dependency injection seam preserving full backward compatibility.Related Issue
Fixes: #5
Type of Change
Changes Made
DepthFirstSearch(List<T> visited)defaulting tonew ArrayList<>()to preserve existing callers.clearVisited()method for explicit accumulator reset between runs.src/main/java/com/thealgorithms/searches/DepthFirstSearch.java.src/test/java/com/thealgorithms/searches/DepthFirstSearchTest.javawith tests covering:node = nullreturningOptional.empty()).node 4with visited[1, 2, 5, 6, 3, 4]).work/R45-T005/check.pyand saved verification evidence inwork/R45-T005/results.jsonandwork/R45-T005/evidence.md.Screenshots / Recordings
N/A (tree search algorithm utility and unit tests; non-UI)
Testing
All changes have been validated locally using JDK 21 and Maven:
mvn test -Dtest=DepthFirstSearchTest(Tests run: 8, Failures: 0, Errors: 0, Skipped: 0)mvn checkstyle:check(0 Checkstyle violations)python3 work/R45-T005/check.py(All checks and repeatability assertions passed successfully)Checklist
mvn checkstyle:check.Additional Notes
work/R45-T005/evidence.md.python3 work/R45-T005/check.py.