Skip to content

Create a new KMP Algorithm #3200

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 6 commits into from
Aug 3, 2022
Merged

Create a new KMP Algorithm #3200

merged 6 commits into from
Aug 3, 2022

Conversation

MarcusCody
Copy link
Contributor

An important issue in computer science is pattern searching. Pattern searching methods display the search results when we do a string search in a database, browser, or notepad/word file.

Describe your change:

  • Add an algorithm?
  • Fix a bug or typo in an existing algorithm?
  • Documentation change?

References

Knuth–Morris–Pratt algorithm

Checklist:

  • I have read CONTRIBUTING.md.
  • I know that pull requests will not be merged if they fail the automated tests.
  • This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.
  • All new Java files are placed inside an existing directory.
  • All filenames are in all uppercase characters with no spaces or dashes.
  • All functions and variable names follow Java naming conventions.
  • All new algorithms have a URL in its comments that points to Wikipedia or other similar explanation.

An important issue in computer science is pattern searching. Pattern searching methods display the search results when we do a string search in a database, browser, or notepad/word file.
Copy link
Member

@siriak siriak left a comment

Choose a reason for hiding this comment

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

The code looks good, could you just replace main() with a couple of JUnit tests? See examples in src/test/

@MarcusCody
Copy link
Contributor Author

Okay I will update the JUnit test case soon

Create a few JUnit tests for KMP Search Algorithm (KMPSearch.java)
Update KMPSearch algorithm by removing the main, and JUnit Test is added for this algorithm
Added package com.thealgorithms.searches into the Java file
@MarcusCody
Copy link
Contributor Author

I have added the test case for KMPSearch Algorithm

Copy link
Member

@siriak siriak left a comment

Choose a reason for hiding this comment

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

Looks good, thanks!

@siriak siriak merged commit 965c203 into TheAlgorithms:master Aug 3, 2022
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