Skip to main content

A Python implementation of Fenwick trees

Project description

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 2.7 and Python 3.x.

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.

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for fenwick, version 0.0.3
Filename, size File type Python version Upload date Hashes
Filename, size fenwick-0.0.3.tar.gz (4.2 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page