Skip to content

Add KMP Substring Search Algorithm #231

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 3, 2024

Conversation

pandeysubash404
Copy link
Contributor

Adding more code file required for #219

Implements the Knuth-Morris-Pratt (KMP) algorithm to efficiently find the first occurrence of a pattern in a given text. Uses the Longest Prefix Suffix (LPS) array to minimize unnecessary comparisons, resulting in a time complexity of O(n + m).

kmpSearch("abxabcabcaby", "abcaby") returns 6 since the pattern "abcaby" starts at index 6.

@pandeysubash404
Copy link
Contributor Author

@iluwatar

I encountered an error during the 'build-and-analyze' process related to the test case RandomNumberTest > testGetRandomNumber():

RandomNumberTest > testGetRandomNumber() FAILED
    org.opentest4j.AssertionFailedError at RandomNumberTest.java:60

Since this issue seems unrelated to my changes, could you please advise on the next steps? I believe the failure may be due to an existing issue in the test or an external factor.

Thanks for your assistance!

Copy link

sonarqubecloud bot commented Nov 3, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarCloud

@iluwatar
Copy link
Owner

iluwatar commented Nov 3, 2024

@iluwatar

I encountered an error during the 'build-and-analyze' process related to the test case RandomNumberTest > testGetRandomNumber():

RandomNumberTest > testGetRandomNumber() FAILED
    org.opentest4j.AssertionFailedError at RandomNumberTest.java:60

Since this issue seems unrelated to my changes, could you please advise on the next steps? I believe the failure may be due to an existing issue in the test or an external factor.

Thanks for your assistance!

Looks like flaky RandomNumberTest.java so no worries on your side. I re-ran the build and everything passed.

@iluwatar iluwatar merged commit 8ea5c8c into iluwatar:master Nov 3, 2024
1 check passed
@iluwatar
Copy link
Owner

iluwatar commented Nov 3, 2024

Looks good! Thank you for the contribution 🎉

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