Skip to content

Made 1-based indexing as the main approach for fenwick tree #1374

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

Closed
wants to merge 2 commits into from
Closed

Conversation

urabhay10
Copy link

#1346

The code now focuses on easier to understand and intrepret 1-based indexing, sentences are also modified to indicate the main approach used here is one-based indexing.

Changed the FenwickTree for 1D, 2D array for sum and for minimum queries

@jxu
Copy link
Contributor

jxu commented Oct 21, 2024

Thanks for your contribution. Note: You didn't fix the part about the ranges, which is what makes the 1-indexing nicer. The ranges are now (g(i),i] instead of [g(i),i]. Please review it carefully. Also restore the 0-based indexing version somewhere for reference.

@jxu
Copy link
Contributor

jxu commented Oct 21, 2024

Also the PR tests show that https://github.com/cp-algorithms/cp-algorithms/blob/main/test/test_fenwick_tree.cpp needs to be fixed, but I have never used the test runners before

@urabhay10 urabhay10 closed this by deleting the head repository Oct 21, 2024
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