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.0.1.tar.gz
(43.7 kB
view details)
File details
Details for the file py_red_black_tree-1.0.1.tar.gz.
File metadata
- Download URL: py_red_black_tree-1.0.1.tar.gz
- Upload date:
- Size: 43.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d2e4890ec4b5bb2d9b73b8d2a9f867a2d7ca961ccb26896521636603b57dce3e
|
|
| MD5 |
f54472eb0e19fdab34071b97559d3869
|
|
| BLAKE2b-256 |
79364be2ea85316057be8d246fe956fe2c23a4a81ae446419213dbfdeba9df3c
|