Skip to content

Add a Fenwick tree data structure #47

Description

@Suvanwita

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions