A high-performance, enterprise-grade Segment Tree implementation for Python
Project description
🌳 Segee
Lightning-fast range queries with O(log n) performance and modern Python design.
✨ Features
🚀 High Performance - O(log n) range queries and updates
🔒 Type Safe - Complete generic type hints for Python 3.12+
🏢 Enterprise Ready - Comprehensive error handling and validation
🧪 Battle Tested - 152 unit tests with ground truth validation
🐍 Pythonic - Full sequence protocol support (tree[i], len(tree), etc.)
⚡ Zero Dependencies - Pure Python with no external requirements
🚀 Quick Start
from segee import SumSegmentTree, MinSegmentTree, MaxSegmentTree
# Sum queries - perfect for range sum problems
sum_tree = SumSegmentTree(1000)
sum_tree[100] = 42
sum_tree[200] = 58
print(sum_tree.sum(100, 201)) # 100
# Min/Max queries - ideal for range minimum/maximum problems
min_tree = MinSegmentTree(1000)
min_tree[50:55] = [10, 5, 20, 15, 8]
print(min_tree.minimum(50, 55)) # 5
# Custom operations - build your own segment tree
import operator, math
gcd_tree = SegmentTree(100, 0, math.gcd)
📦 Installation
pip install segee
🏗️ Architecture
segee/
├── segment_tree/ # Segment tree implementations
│ ├── segment_tree.py # Generic segment tree core
│ └── specialized.py # Sum/Min/Max convenience classes
├── exceptions.py # Custom exception hierarchy
└── _types.py # Type definitions and protocols
📚 Documentation
- Usage Guide - Comprehensive examples and patterns
- API Reference - Complete method documentation
- Performance - Benchmarks and complexity analysis
- Contributing - Development setup and guidelines
📄 License
MIT License - see LICENSE for details.
Built with ❤️ for the Python community
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file segee-0.1.0.tar.gz.
File metadata
- Download URL: segee-0.1.0.tar.gz
- Upload date:
- Size: 21.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ec024c17c9636eb2599680207b01c6b2bc6ab53657af208b72161669af31e194
|
|
| MD5 |
450560976caabe727d6906e752f601ae
|
|
| BLAKE2b-256 |
9fb8158a2850ac32eff80eb9bdf48ce6325d823842c5ed16b89726e1f362fce7
|
File details
Details for the file segee-0.1.0-py3-none-any.whl.
File metadata
- Download URL: segee-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b299a70f895c4cf15b1fe52bfba962b562a4bfa9f4e97e6846a0bcc0718a7f74
|
|
| MD5 |
2613217a189f9078d548e9b165acc048
|
|
| BLAKE2b-256 |
9b0da106d09465f58dad4f56bafadb53d77185c89486a6422c8535449c6880cc
|