Changed knuth_morris_pratt to be consistent with str.find()#9079
Changed knuth_morris_pratt to be consistent with str.find()#9079Akashram28 wants to merge 9 commits intoTheAlgorithms:masterfrom Akashram28:kmp_return_index
Conversation
|
Change |
|
In your PR description, you should tick whatever suits your PR but don't delete other checkboxes, also tick that checkbox for bug fixing or doc change which u deleted. |
Co-authored-by: Rohan Anand <96521078+rohan472000@users.noreply.github.com>
|
@cclauss , kindly review it. |
|
Thanks. "doctests" are more desirable than print statements. While we're at it, let's write some tests instead. |
|
Just to note, you can use some keywords in your commit message to link a pull request to an issue, that way if your PR is accepted, the linked issue gets closed automatically. https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue |
for more information, see https://pre-commit.ci
|
I added doctests that fail... As discussed in CONTRIBUTING.md, you can run these on your own computer with: |
|
while testing the doctests added by @cclauss with existing code of |
|
If we are going to be consistent with |


Describe your change:
function kmp() now returns the first occurrence of the pattern. If the pattern does not exist in the given text, it returns -1
See #9077
Checklist: