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)
| File | Size | Uploaded | |
|---|---|---|---|
| fenwick-0.2.0.tar.gz | 5.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| 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
|