C++ templates for competitive programming, algorithm practice, and reusable problem-solving patterns.
This repository is organized by topic. Each template aims to be:
- Easy to copy into contests
- Object-oriented where it improves readability
- Small enough to review quickly
- Documented with use cases and complexity
algorithm-templates/
data-structures/
segment-tree/
segment-tree-oop.cpp
README.md
| Topic | Template | Description |
|---|---|---|
| Data Structures | Segment Tree | Object-oriented segment tree supporting range query and point update. |
- Fenwick tree
- Disjoint set union
- Sparse table
- Dijkstra
- Kruskal
- Tarjan
- KMP
- Trie
- Knapsack DP
Most templates are standalone C++ files. You can copy the file into an online judge solution or compile it locally:
g++ -std=c++17 data-structures/segment-tree/segment-tree-oop.cpp -o segment-tree
./segment-tree