Tree Containers
Asymptotically-efficient tree-based containers in pure Python. Licensed under the Apache License Version 2.0.
Priority Map
A combination between a heap and a map that stores key:priority mappings.
Operations
| Operation | Description | Runtime Complexity |
|---|---|---|
__getitem__(key) |
Get priority of key | O(1) |
__setitem__(key, priority) |
Set priority of key | O(log n) |
__delitem__(key) |
Remove a key | O(log n) |
__contains__(key) |
Check whether a key is contained | O(1) |
__len__() |
Return the number of keys contained | O(1) |
peek() |
Get lowest-priority key and its priority | O(1) |
pop() |
Get and remove lowest-priority key and its priority | O(log n) |
Example Console Output
>>> from prioritymap import PriorityMap
>>> pm = PriorityMap()
>>> pm["first"] = 1
>>> pm["second"] = 2
>>> pm["underdog"] = 5
>>> pm.peek()
('first', 1)
>>> pm["underdog"] = 0
>>> len(pm)
3
>>> pm.pop()
('underdog', 0)
>>> pm.pop()
('first', 1)
>>> pm.pop()
('second', 2)
>>> len(pm)
0
PrioritySet
To be implemented.
TreeMap
To be implemented.
Metadata
Release files for treecontainers 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| treecontainers-0.0.1.tar.gz | 6.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| treecontainers-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.1 kB
Release files / treecontainers-0.0.1.tar.gz
| Download URL | treecontainers-0.0.1.tar.gz |
|---|---|
| Size | 6.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c51e4cffcd06fa55169a81fa3bdb9ad48dd74055b5e0fa27785dffe3bc0e9730
|
|
BLAKE2b-256 checksum How to use checksums |
ce672f40d47efe044fbc21a94ec34929424374692a7c3106d8428eac4ad6e1d6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.6
|
Release files / treecontainers-0.0.1-py3-none-any.whl
| Download URL | treecontainers-0.0.1-py3-none-any.whl |
|---|---|
| Size | 7.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ac9ddb67c571fa5b5bd1c3e6b1113cab6232aff97ec0bd314a17cc3d19b9eb8c
|
|
BLAKE2b-256 checksum How to use checksums |
4419e5b23e0bd1903a1b307a7fdf7a1bd5f14816cb4009d2e4368ffc1a0d62b0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.6
|