Skip to content

Conversation

Roniscend
Copy link

Description

Implements the Z-Algorithm for pattern matching in linear time O(n+m).

Changes

  • Added ZAlgorithm.java with linear time pattern matching implementation
  • Added comprehensive test cases in ZAlgorithmTest.java
  • Includes both pattern search and Z-array computation methods

Features

  • O(n+m) time complexity for pattern matching

  • Handles edge cases (null inputs, empty strings, overlapping patterns)

  • Well-documented with JavaDoc comments

  • 13 comprehensive test cases covering all scenarios

  • [x ] I have read CONTRIBUTING.md.

  • [x ] This pull request is all my own work -- I have not plagiarized it.

  • [x ] All filenames are in PascalCase.

  • [x ] All functions and variable names follow Java naming conventions.

  • [ x] All new algorithms have a URL in their comments that points to Wikipedia or other similar explanations.

  • [ x] All new code is formatted with clang-format -i --style=file path/to/your/file.java

@codecov-commenter
Copy link

codecov-commenter commented Oct 1, 2025

Codecov Report

❌ Patch coverage is 0% with 35 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.10%. Comparing base (5e9d9f7) to head (095fa07).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...ain/java/com/thealgorithms/strings/ZAlgorithm.java 0.00% 35 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #6579      +/-   ##
============================================
- Coverage     75.23%   75.10%   -0.13%     
- Complexity     5626     5629       +3     
============================================
  Files           691      692       +1     
  Lines         19448    19485      +37     
  Branches       3758     3768      +10     
============================================
+ Hits          14632    14635       +3     
- Misses         4248     4283      +35     
+ Partials        568      567       -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.

@Roniscend Roniscend force-pushed the add-z-algorithm branch 3 times, most recently from e944559 to 2a00c6b Compare October 1, 2025 19:31
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.

2 participants