Skip to content

Add KMP string matching algorithm (#2719) #2930

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

YashAstro11
Copy link

🚀 Description

This PR adds the implementation of the Knuth-Morris-Pratt (KMP) string matching algorithm under the strings/ directory.

  • Efficient pattern searching using LPS (Longest Prefix Suffix) array.
  • Time Complexity: O(n + m)
  • Space Complexity: O(m)

📂 File Added

  • strings/kmp_string_matching.cpp

✅ Related Issue

Closes #2719


Let me know if any changes are required. Glad to contribute! ✨

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.

[BUG] Approved label CI does not add approved label to pull requests.
1 participant