docs: improve LinearSearch Javadoc with step-by-step explanation and examples#7339
Open
NajoroRabiaza wants to merge 2 commits intoTheAlgorithms:masterfrom
Open
docs: improve LinearSearch Javadoc with step-by-step explanation and examples#7339NajoroRabiaza wants to merge 2 commits intoTheAlgorithms:masterfrom
NajoroRabiaza wants to merge 2 commits intoTheAlgorithms:masterfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #7339 +/- ##
=========================================
Coverage 79.45% 79.45%
Complexity 7082 7082
=========================================
Files 790 790
Lines 23161 23161
Branches 4556 4556
=========================================
Hits 18403 18403
Misses 4022 4022
Partials 736 736 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Closes #7334
The LinearSearch implementation was correct but the documentation
was minimal. This PR improves the Javadoc to help beginners understand
how the algorithm works.
Changes made:
Added a step-by-step explanation of how the algorithm works
Added a concrete example that traces the execution index by index
Added a "not found" example with return value -1
Added time and space complexity explanation
Improved the find() method Javadoc
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