Skip to content

Commit ab8713f

Browse files
committed
Adding solution ok KMP algorithm
## Fixing Issue #3543 ## Description This pull request adds the implementation of the Knuth-Morris-Pratt (KMP) algorithm in C++ to the DSA folder. The KMP algorithm is used for pattern matching and is efficient in finding occurrences of a pattern within a text. It preprocesses the pattern to create a partial match table, which allows the algorithm to skip unnecessary comparisons, improving the overall search time. ## Type of PR - [ ] Bug fix - [x] Feature enhancement - [ ] Documentation update - [ ] Security enhancement - [ ] Other (specify): _______________ ## Checklist - [x] I have performed a self-review of my code. - [x] I have read and followed the Contribution Guidelines. - [x] I have tested the changes thoroughly before submitting this pull request. - [x] I have provided relevant issue numbers, screenshots, and videos after making the changes. - [x] I have commented my code, particularly in hard-to-understand areas. - [x] I have followed the code style guidelines of this project. - [x] I have checked for any existing open issues that my pull request may address. - [x] I have ensured that my changes do not break any existing functionality. - [x] Each contributor is allowed to create a maximum of 4 issues per day. This helps us manage and address issues efficiently. - [x] I have read the resources for guidance listed below. - [x] I have followed security best practices in my code changes. ## Additional Context The Knuth-Morris-Pratt (KMP) algorithm implementation includes the following features: - Preprocessing of the pattern to create a partial match (or "failure") table. - Efficient pattern searching within a text using the preprocessed table. - Skipping of unnecessary comparisons, resulting in improved search time compared to naive string matching algorithms. ## Resources for Guidance Please read the following resources before submitting your contribution: - [x] [Code Harbor Hub Community Features](https://www.codeharborhub.live/community/features) - [x] [Markdown Guide](https://www.markdownguide.org/)
1 parent cc930c6 commit ab8713f

File tree

2 files changed

+461
-172
lines changed

2 files changed

+461
-172
lines changed

0 commit comments

Comments
 (0)