Skip to content
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

Possible error found in CP4 book 2 #99

Open
ajadhav opened this issue Mar 20, 2022 · 0 comments
Open

Possible error found in CP4 book 2 #99

ajadhav opened this issue Mar 20, 2022 · 0 comments

Comments

@ajadhav
Copy link

ajadhav commented Mar 20, 2022

Hi,
I've been looking at the KMP example on pg 335 in Chapter 6 of CP4 book 2.
I noticed that in the examples you seem to preprocess a table that is pattern size + 1,
so that the kmpSearch can reset correctly once a match is found ( j = b[j])
However the kmpPreprocess function seems to only iterate for i < m.
Assuming m is the size of the pattern string we won't fully fill out the table,
should the preprocessing iterate for i <= m ? Or is m here the size of the pattern+1?
Or maybe I am misunderstanding something. Any clarification is appreciated!

Thanks,
Anup

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

No branches or pull requests

1 participant