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

Fixing loop range bug in pseudocode #31

Merged
merged 1 commit into from
Sep 10, 2016
Merged

Fixing loop range bug in pseudocode #31

merged 1 commit into from
Sep 10, 2016

Conversation

thundergolfer
Copy link
Contributor

when length = 2 (first iteration of outer loop), start = N-1 (last iteration of middle loop), and len1 = N-1 (last iteration of inner loop),
second index of the reference to P which is start + len1 equals
2*N - 2, that is out of the array bounds for N > 1

I have successfully implemented CYK in Java using this amended pseudocode. Without the amendment you get a NullPointerException

Credit to izard for bug discovery back in 2012

@norvig norvig merged commit 976ed6c into aimacode:master Sep 10, 2016
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.

2 participants