A python module for competitive programmers
Project description
python-competitive
*python-competitive is a lightweight and growing Python library that provides a clean, well-documented collection of data structures and algorithms commonly used in computer science, competitive programming, and technical interviews.
✅ Features
This library includes thoroughly tested and modular implementations of:
📦 Data Structures
- Arrays
- Linked Lists
- Stack / Queue / Deque
- Segment Tree
- Binary Search Tree
- AVL Tree
- Red-Black Tree
- Suffix Tree / Suffix Array
- Trie
- Graphs (Adjacency List)
- Disjoint Set Union (DSU)
- Skip List
- Binary Indexed Tree (Fenwick Tree)
- BitSet
- Heap / Priority Queue
- Hash Table
📐 Algorithms & Math
- GCD / LCM
- Prime Factorization
- Sieve of Eratosthenes
- Modular Arithmetic (Inverse, Power)
- Binomial Coefficient (mod p)
- Chinese Remainder Theorem
- Matrix operations (Multiply, Inverse, Determinant)
- Quicksort
- Binary Search
- isSorted
📘 Usage
Every class and function includes Markdown-style docstrings for hover help and in-editor documentation. No need to navigate to separate files. visit the wiki for more details
Example:
from pyAlgorithm import SegmentTree, mod_inverse
tree = SegmentTree(8)
tree.set(3, 10)
tree.set(4, 7)
print(tree.query(3, 4)) # Output: 17
print(mod_inverse(3, 11)) # Output: 4
🚀 Coming Soon
- Graph algorithms (Dijkstra, Floyd-Warshall, Kruskal)
- Network flow (Ford-Fulkerson, Edmonds-Karp)
- Visualizers for trees and graphs
- PyPI package release and playground CLI
📂 Project Structure
pyAlgorithm/
├── src/
│ ├── __init__.py # Exposes everything via pyAlgorithm
│ ├── DataStructs.py # All data structures
│ └── Funcs.py # All utility functions and algorithms
├── README.md
🤝 Contributing
Pull requests are welcome! Add new algorithms, clean up code, or expand documentation. Star the repo if you find it helpful!
📜 License
MIT License — free to use, modify, and distribute.
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 python_competitive-0.2.tar.gz.
File metadata
- Download URL: python_competitive-0.2.tar.gz
- Upload date:
- Size: 21.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ce0a2975ad8484fa3e2d38e91431de01be1acc5503dde4c427bd2f3e6a8b0dab
|
|
| MD5 |
151b46e2fb1e8d06c7fb4d094e610709
|
|
| BLAKE2b-256 |
c11be3a71b4b49550efb51c7f4c98ff6719935f93fe28e9ae82df9e27d5f6d31
|
File details
Details for the file python_competitive-0.2-py3-none-any.whl.
File metadata
- Download URL: python_competitive-0.2-py3-none-any.whl
- Upload date:
- Size: 20.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
30918d8a5e7874adcafcdcf586ab8bde61bdea89b0be99458b3dd8d0fb52215e
|
|
| MD5 |
0a27660046ad34c347770a2339524ad3
|
|
| BLAKE2b-256 |
8fde7e367d732f1c99c00152d2b0e72ea6ae1966091e4aabe69947436a4f274a
|