Skip to content

Update with KMP substring search algorithm #229

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

Closed
wants to merge 4 commits into from
Closed

Update with KMP substring search algorithm #229

wants to merge 4 commits into from

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.

Copy link

Quality Gate Failed Quality Gate failed

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

See analysis details on SonarCloud

/*
* MIT License
*
* Copyright (c) 2017-2022 Ilkka Seppälä

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update copyright year properly . (2017-2024)
Applies across patch.

@Ritabrata1080
Copy link

Points to take care :

  1. Try to get a successful check for the rules set.
  2. Squash all the commits.
  3. Consider updating copyright year in the header.

cc : @iluwatar

@pandeysubash404 pandeysubash404 closed this by deleting the head repository Oct 16, 2024
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