pyavl3
A python dictionary alternative implemented with an AVL Tree.
Quick Start
pip install pyavl3
from pyavl3 import AVLTree
a = AVLTree()
a[1] = "Hello"
a[2] = "world!"
print(", ".join(a.values()))
Why?
Python dictionaries are implemented on hashmaps. Hashmaps, besides being awesome, are a balancing act between efficiency and memory utilization. Python's builtin algorithm is solid and probably the correct choice 99 times out 100. Not really a supprise. But, hashmaps suffers from the need to resize and resizing is pretty expensive. For those few cases where resizing large in-memory blocks of sequentional memory is not going to work, AVLTrees might be a better option. Oh, and AVLTrees are effectivly sorted. So, iterators are deterministic and always in order.
This table compairs the runtime characteristics of Hashtables and AVLTrees
| Hashtable | Hashtable(worst case) | AVLTree | AVLTree(worst case) | |
|---|---|---|---|---|
| Space | O(n) | O(n) | O(n) | O(n) |
| Search | O(1) | O(n) | O(logn) | O(logn) |
| Insert | O(1) | O(n) | O(logn) | O(logn) |
| Delete | O(1) | O(n) | O(logn) | O(logn) |
| Resize | O(n) | O(n) | N/A | N/A |
Metadata
Release files for pyavl3 1.0.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 | |
|---|---|---|---|
| pyavl3-1.0.0.tar.gz | 6.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyavl3-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.7 kB
Release files / pyavl3-1.0.0.tar.gz
| Download URL | pyavl3-1.0.0.tar.gz |
|---|---|
| Size | 6.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e3532746585d2ed997619bdea9e616bd9b449ad12f663dc4092d10f3e3d4901d
|
|
BLAKE2b-256 checksum How to use checksums |
cbf9a48abd1e59f7db5ec6a07615914bbfe87f21a2bc165d61217c1ce859d087
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.9
|
Release files / pyavl3-1.0.0-py3-none-any.whl
| Download URL | pyavl3-1.0.0-py3-none-any.whl |
|---|---|
| Size | 8.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a56c98839b8141757eea42bdcc2bf9ff8c6299065bb51505e96f063365035659
|
|
BLAKE2b-256 checksum How to use checksums |
779096485005bae96e423f019ce09198402813d76c40e44f0dd8384b8a7b4080
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.9
|