Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/dstein64/fenwick

An implementation of Fenwick trees (Fenwick 1994).
https://github.com/dstein64/fenwick

binary-indexed-tree data-structures fenwick-tree

Last synced: about 2 months ago
JSON representation

An implementation of Fenwick trees (Fenwick 1994).

Awesome Lists containing this project

README

        

.. image:: https://github.com/dstein64/fenwick/workflows/build/badge.svg
:target: https://github.com/dstein64/fenwick/actions

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.