We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
In ch9/SparseTable.cpp
ch9/SparseTable.cpp
P2.assign(L2_n, 0); L2.assign(1<<L2_n, 0); for (int i = 0; i <= L2_n; ++i) { P2[i] = (1<<i); L2[(1<<i)] = i; }
P1 is a vector and is assigned with L2_n elements of 0 (from index 0 to L2_n-1), but in the iteration, it accesses P2[i = L2_n] which does not exist.
P1
L2_n
0
L2_n-1
P2[i = L2_n]
The text was updated successfully, but these errors were encountered:
Another bug on line-32:
for (int i = 1; P2[i] <= n; ++i)
P2[] is declared as a vector of size L2_n where L2_n is log2(n)+1 (line-16), so line-32 obviously suffers from index out-of-bound.
P2[]
log2(n)+1
Sorry, something went wrong.
No branches or pull requests
In
ch9/SparseTable.cpp
P1
is a vector and is assigned withL2_n
elements of0
(from index0
toL2_n-1
), but in the iteration, it accessesP2[i = L2_n]
which does not exist.The text was updated successfully, but these errors were encountered: