High-performance red-black tree implementation in C with Python bindings
Project description
py-rbtree
A high-performance red-black tree implementation in C with Python bindings.
Features
- Fast: O(log n) insert, search, and delete operations
- Self-balancing: Automatically maintains index ordered
Installation
pip install py-red-black-tree
Quick Start
import rbtree
# Create a tree
tree = rbtree.RBTree()
# Insert key-value pairs
tree.insert(10, "ten")
tree.insert(5, "five")
tree.insert(15, "fifteen")
# Search
value = tree.search(10) # Returns "ten"
# Check membership
if 10 in tree:
print("Found!")
# Size
print(len(tree)) # 3
# Sorted traversal
items = tree.inorder() # [(5, 'five'), (10, 'ten'), (15, 'fifteen')]
# Delete
tree.delete(5)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
py_red_black_tree-1.1.1.tar.gz
(44.4 kB
view details)
File details
Details for the file py_red_black_tree-1.1.1.tar.gz.
File metadata
- Download URL: py_red_black_tree-1.1.1.tar.gz
- Upload date:
- Size: 44.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
86662566cdaf9c270f08679ab6787cc23d6454a6a6e5afca63028a2311671954
|
|
| MD5 |
dfb7365a55e8a9d469ad38b2dfde5873
|
|
| BLAKE2b-256 |
f6bdc87835bd642755fd975916a90d25450fba5018c1ab152959b0658807abf2
|