Welcome To BSTree
Effortlessly manage your data with ultra-fast, balanced Binary Search Trees!
🔑 Key Features 🔑
🚀 Provides a Binary Search Tree (BST) data structure.
The library implements a highly efficient Binary Search Tree (BST), allowing quick lookups, insertions, and deletions. A Binary Search Tree ensures that elements are stored in a sorted order, making searches highly efficient.
🚀 Supports insertion, searching, and deletion of data in O(log(N)) time complexity.
Thanks to the Red-Black Tree (RBTree) implementation, the BST is always balanced. This guarantees that the maximum time complexity for insertion, search, and deletion operations is O(log(N)), even in the worst-case scenario. This ensures that the performance remains stable and predictable regardless of the order of operations or data.
🚀 Offers methods to find the n-th smallest value and get the rank of a value, both in O(log(N)) time complexity.
These methods leverage the balanced structure of the RBTree, ensuring that both finding the n-th smallest value and determining the rank of a value happen in logarithmic time. This provides efficient querying even with large datasets.
🚀 Implemented using a Red-Black Tree (RBTree) structure in C for performance.
The Red-Black Tree structure ensures that the binary tree remains balanced at all times, providing optimal performance for operations like insertion, search, and deletion. This guarantees O(log(N)) time complexity for all major operations, even in the worst case, making it one of the most efficient data structures for dynamic sets.
🚀 Can handle int, float, and any objects that support comparison operations.
The library is flexible and supports a wide range of data types, including integers, floating-point numbers, and any custom objects that implement comparison operations. This makes it suitable for a wide variety of use cases, from numeric data processing to more complex object management.
🛠️ How to install 🛠️
To install the BSTree library, simply run:
pip install -U bstree
Make sure you have Python 3.x installed and the pip tool is available in your environment.
✏️ Basic Usage ✏️
Example of basic usage: insert and search data in the BSTree.
# Create a BSTree object
tree = BSTree()
# Insert data into the tree
tree.insert(10)
tree.insert(5)
tree.insert(15)
# Search for data in the tree
if tree.has(10):
print("10 found in the tree!")
# Get the 3rd smallest value
third_smallest = tree.kth_smallest(3)
print(f"The 3rd smallest value is: {third_smallest}")
# Get the rank of a value
rank_of_10 = tree.rank(10)
print(f"The rank of 10 is: {rank_of_10}")
# Clear the BSTree
tree.clear()
📓 Additional Information 📓
For more details, visit the following pages:
📝 License 📝
This project is licensed under the MIT License - see the LICENSE for details.
Metadata
Release files for bstree 0.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| bstree-0.8.tar.gz | 15.8 kB | Without provenance | Details for bstree-0.8.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| bstree-0.8-cp312-cp312-win_amd64.whl | CPython 3.12 | CPython 3.12 | Windows x86-64 | Details for bstree-0.8-cp312-cp312-win_amd64.whl |
Total release size: 33.1 kB
Release files / bstree-0.8.tar.gz
| Download URL | bstree-0.8.tar.gz |
|---|---|
| Size | 15.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5c7636155af704db360dbe0e598ad270bbda07cd0380e7ee131308e8e109d1fc
|
|
BLAKE2b-256 checksum How to use checksums |
3373bfe31ab6a41dacf9a9f588f47bf0b4933adeb73cac5cb2aa44d14862eff4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.12.0
|
Release files / bstree-0.8-cp312-cp312-win_amd64.whl
| Download URL | bstree-0.8-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 17.4 kB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
05fb863e4af71eb11e3cd41cc7d69c439f86c09c11b10ff7654c49c6baf20eeb
|
|
BLAKE2b-256 checksum How to use checksums |
75edcf7990b6a12f0c29aa8d5a1a000f5d5b4d537d781455266563bb1b072537
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.12.0
|
Security for bstree 0.8
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.