Summary
Add a Fenwick tree (Binary Indexed Tree) implementation to src/data_structures.
Requirements
- Support creating an empty Fenwick tree for a given size.
- Support point updates and prefix sum queries.
- Support range sum queries via prefix sum combination.
- Support efficient initialization from an array.
- Support retrieving the total sum of all elements.
- Document the indexing convention and zero-based or one-based behavior clearly.
- Handle invalid indices consistently and document the behavior.
Testing
Add tests covering:
- empty and single-element trees
- point updates
- prefix sum queries
- range sum queries
- initialization from an array
- invalid index updates and queries
Documentation
Document the public API and include a short usage example consistent with the repository’s existing data structure modules.
Summary
Add a Fenwick tree (Binary Indexed Tree) implementation to
src/data_structures.Requirements
Testing
Add tests covering:
Documentation
Document the public API and include a short usage example consistent with the repository’s existing data structure modules.