A curated collection of algorithms, data structures, and templates for competitive programming.
This repository serves as a personal reference for competitive programming contests, providing organized and reusable code templates for common algorithms and data structures.
- Longest Increasing Subsequence (LIS)
- Custom Comparators
- Coordinate Compression
- String Split
- Binary Conversions
- Measuring Function Execution Time
- Random Number Generator
Data Structures
- Segment Tree (Iterative)
- Disjoint Set Union (DSU)
- Fenwick Tree / Binary Indexed Tree
- Sparse Table
- Treap
- Persistent Segment Tree
- Implicit Segment Tree
- Sqrt Decomposition
- Mo's Algorithm
- Heavy-Light Decomposition
- Wavelet Tree
- Lazy Propagation Segment Tree
- 2D Data Structures
- Policy-Based Data Structures (C++)
Graph Algorithms
- BFS / DFS
- Dijkstra's Algorithm
- Bellman-Ford Algorithm
- Floyd-Warshall Algorithm
- Minimum Spanning Tree (Kruskal/Prim)
- Topological Sort
- Strongly Connected Components (Kosaraju/Tarjan)
- Articulation Points and Bridges
- Biconnected Components
- Euler Path/Circuit
- Maximum Flow (Ford-Fulkerson, Dinic, Push-Relabel)
- Minimum Cost Maximum Flow
- Bipartite Matching
- Hungarian Algorithm
- Lowest Common Ancestor (LCA)
- Centroid Decomposition
Math
- Sieve of Eratosthenes
- Linear Sieve
- Segmented Sieve
- Prime Factorization
- Modular Arithmetic
- GCD and LCM
- Extended Euclidean Algorithm
- Chinese Remainder Theorem
- Euler's Totient Function
- Fast Exponentiation
- Combinatorics
- Permutations
- Combinations
- Catalan Numbers
- Probability
- Expected Value
- Game Theory
- Nimbers and Grundy Numbers
- Fast Fourier Transform (FFT)
- Number Theoretic Transform (NTT)
Strings
- KMP (Knuth-Morris-Pratt)
- Z-Algorithm
- Rolling Hash
- Rabin-Karp
- Trie
- Suffix Array
- Suffix Tree
- Aho-Corasick
- Manacher's Algorithm
- Palindromic Tree
- Suffix Automaton
Geometry
- Points, Lines, Vectors
- Polygon Area
- Convex Hull
- Line Sweep
- Closest Pair of Points
- Point in Polygon
- Line Intersection
- Circle Intersection
- Rotating Calipers
- Delaunay Triangulation
Dynamic Programming
- Longest Increasing Subsequence (LIS)
- Longest Common Subsequence (LCS)
- Classical Problems
- Optimization Techniques
- Digit DP
- DP on Trees
- DP with Bitmasks
- DP with Convex Hull Trick
- DP with Divide and Conquer
- SOS DP
Templates
- Fast I/O template
- Debugging utilities
- Contest template with common includes and macros
- Code snippets for common tasks
Notes
- Common edge cases
- Contest strategies
- Problem-solving approaches
- Time complexity cheat sheet
- Memory usage optimization
- Custom Comparators
- Implementation tricks
- Binary search applications
- Two pointers technique
- Meet in the Middle
- Interactive problems approach
- Randomized algorithms
- Heuristics
- Binary Conversions
Backtracking
- Permutations
- Combinations
- Subset Generation
- N-Queens Problem
- Sudoku Solver
- Maze Solver
- LinkedIn: in/TryOmar
- LeetCode: TryOmar
- CodeForces: TryOmar
- MonkeyType: TryOmar