Java icon indicating copy to clipboard operation
Java copied to clipboard

[FEATURE REQUEST] <title>

Open ragavi-632007 opened this issue 1 month ago • 1 comments

What would you like to Propose?

Issue Title:

Add KMP (Knuth–Morris–Pratt) String Matching Algorithm Implementation Description:

I would like to request the addition of the KMP string matching algorithm to this repository. This algorithm efficiently finds occurrences of a pattern within a text using preprocessing of the pattern to avoid redundant comparisons.

Why this is useful:

KMP runs in O(n + m) time, making it much faster than the naïve string matching algorithm.

It’s a classic example of efficient pattern searching, useful in various applications like text editors, DNA sequence matching, and plagiarism detection.

Adds educational and algorithmic value to the repository.

Proposed Implementation: Implement the kmp_search(text, pattern) function in Python/Java/C++ (depending on project language) that:

Builds the LPS (Longest Prefix Suffix) array for the pattern.

Uses it to efficiently search for the pattern in the text.

Issue details

Why this is useful:

KMP runs in O(n + m) time, making it much faster than the naïve string matching algorithm.

It’s a classic example of efficient pattern searching, useful in various applications like text editors, DNA sequence matching, and plagiarism detection.

Adds educational and algorithmic value to the repository.

Proposed Implementation: Implement the kmp_search(text, pattern) function in Python/Java/C++ (depending on project language) that:

Builds the LPS (Longest Prefix Suffix) array for the pattern.

Uses it to efficiently search for the pattern in the text.

Additional Information

No response

ragavi-632007 avatar Oct 12 '25 02:10 ragavi-632007