Skip to main content

AVL tree (self-balancing binary search tree) implementation.

Project description

AVL Tree Library

A simple implementation of an AVL tree (self-balancing binary search tree). It stores values associated with keys and performs insertion, deletion, and search operations in $O(\log n)$ time.

Installation

pip install BalancedBstAvl

Usage

from avltree import AVLTree

tree = AVLTree()
tree = tree.set(10, "a")
tree = tree.set(5, "b")
tree = tree.set(15, "c")

print(tree.find(10))
print(tree.get(5))
print(tree.items())

tree = tree.delete(10)
print(tree.items())

Features

  • Insert/Update keys: set(x, value) (inserts if not present, updates if exists)
  • Delete keys: delete(x)
  • Check key existence: find(x)
  • Retrieve values: get(x, default=None)
  • Traverse: items() (in ascending key order)

Dependencies

  • Runtime: None (Python standard library only)
  • Development: pytest and others (install with pip install -e .[dev])

Supported Environments

  • Python 3.9, 3.10, 3.11, 3.12, 3.13
  • OS: Windows / macOS / Linux

Development

pip install -e .[dev]
pytest

License

MIT License

Project details


Download files

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

Source Distribution

balancedbstavl-1.0.0.tar.gz (11.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

balancedbstavl-1.0.0-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file balancedbstavl-1.0.0.tar.gz.

File metadata

  • Download URL: balancedbstavl-1.0.0.tar.gz
  • Upload date:
  • Size: 11.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for balancedbstavl-1.0.0.tar.gz
Algorithm Hash digest
SHA256 0c13fe3fadc70a2fd87dcbbd8c18153bdb38ed578a82ed4e80d50ce9453cf71b
MD5 ec4dc5b44adb48547c12ea141caf5fc6
BLAKE2b-256 f6e77fc47bec624caeaad44e5e07fcf5fc76adf0215205ed5f69aa6091a7350a

See more details on using hashes here.

Provenance

The following attestation bundles were made for balancedbstavl-1.0.0.tar.gz:

Publisher: pypi-publish.yml on Shinoryo/BalancedBstAvl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file balancedbstavl-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: balancedbstavl-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for balancedbstavl-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 65e512e752f28d21266ccd960e8fe115e2d9b3b74fa4195c620a6986358aebde
MD5 1eb71824fb0588d39f1396b828e798f1
BLAKE2b-256 1936af61168f9a8f4fe3cfb02240cdbec7d8e5abd37322d6a34f2c3923f98a29

See more details on using hashes here.

Provenance

The following attestation bundles were made for balancedbstavl-1.0.0-py3-none-any.whl:

Publisher: pypi-publish.yml on Shinoryo/BalancedBstAvl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page