Skip to main content
https://github.com/dstein64/fenwick/workflows/build/badge.svg

fenwick

A Python library that implements Fenwick trees, based on the algorithm in (Fenwick 1994).

Features

  • Update a frequency in O(log n).

  • Retrieve a single frequency in O(log n).

  • Initialize existing frequencies in O(n).

  • Retrieve all frequencies in O(n).

Requirements

fenwick supports python>=3.6.

Linux, Mac, and Windows are supported.

Installation

fenwick is available on PyPI, the Python Package Index.

$ pip install fenwick

Documentation

See documentation.md.

Example Usage

See example.py.

Tests

Tests are in tests/.

# Run tests
$ python -m unittest discover tests -v

License

The code in this repository has an MIT License.

See LICENSE.

References

Fenwick, Peter M. 1994. “A New Data Structure for Cumulative Frequency Tables.” Software: Practice and Experience 24 (3): 327–36.

Metadata

Release files for fenwick 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fenwick 0.2.0
File Size Uploaded
fenwick-0.2.0.tar.gz 5.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fenwick 0.2.0
File Interpreter ABI Platform
fenwick-0.2.0-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 10.5 kB

Release files / fenwick-0.2.0.tar.gz

Download URL fenwick-0.2.0.tar.gz
Size 5.8 kB
Tags Source
SHA-256 checksum
How to use checksums
151cb712886b4c4f767a9bd4d1a328e22ff61ec8a4d792de762b1d0ec3da43ac
BLAKE2b-256 checksum
How to use checksums
cec0c1718b78bf8ce0c9f3e109018fd1c7e3e6b9ed192e91f77779671b5e9852
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.3

Release files / fenwick-0.2.0-py2.py3-none-any.whl

Download URL fenwick-0.2.0-py2.py3-none-any.whl
Size 4.7 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
cdbf23efd877bcde8b777af4332dd0b371772ddd072474a0f313ad1394496fa1
BLAKE2b-256 checksum
How to use checksums
143dd82aee46ed001ea8fc61fd9a0524235bedba81fb712f40b9ebf7d2dda52b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.0

2 release files

0.0.3

1 release file

0.0.2

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page