Skip to content

Conversation

Karthikn-VR
Copy link

This commit adds the Naive Pattern Search algorithm implementation in Java. The algorithm scans the text from left to right and checks each substring of length m (pattern length) to find matches.

  • New class: NaivePatternSearch.java
  • Provides search(String text, String pattern) method returning all match indices
  • Includes a sample main() for demonstration

Time Complexity: O(n * m)
Space Complexity: O(1)

  • 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 code is formatted with clang-format -i --style=file path/to/your/file.java

This commit adds the Naive Pattern Search algorithm implementation in Java. 
The algorithm scans the text from left to right and checks each substring of 
length m (pattern length) to find matches.

- New class: NaivePatternSearch.java
- Provides `search(String text, String pattern)` method returning all match indices
- Includes a sample main() for demonstration

Time Complexity: O(n * m)
Space Complexity: O(1)
@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 0% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.06%. Comparing base (e78d53d) to head (a3083ec).

Files with missing lines Patch % Lines
.../com/thealgorithms/strings/NaivePatternSearch.java 0.00% 9 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #6505      +/-   ##
============================================
- Coverage     75.09%   75.06%   -0.03%     
- Complexity     5569     5570       +1     
============================================
  Files           686      687       +1     
  Lines         19307    19316       +9     
  Branches       3732     3734       +2     
============================================
+ Hits          14498    14499       +1     
- Misses         4245     4254       +9     
+ Partials        564      563       -1     

☔ View full report in Codecov by Sentry.
📢 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.

@DenizAltunkapan
Copy link
Collaborator

Please fix the checkstyle issues that cause the failing build check @Karthikn-VR

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.

3 participants