algorithms
algorithms copied to clipboard
🎈My notebook and solutions for 300+ problems that I solved during practice for ACM-ICPC
trafficstars
"Think twice, code once"
Overview
I use this repository as a study playground for programming contests, which contains my personal notes and implementations. Note that this is a publish-only repository, so all pull requests will be ignored.
The folders structure is following:
notebook: well-explained implementation of general-purpose algorithms.scripts: small scripts for automatizing some repetitive tasks.solutions: code of accepted problems, categorized by online judges.README.md: solutions index by themes, containing difficulty, name, description and hint of the problem.
Notebook index
🧱 data structures
- segment tree
- lazy segment tree
- sparse table
- union-find disjoint sets (UFDS)
🥊 brute force
🔞 dynamic programming
- coin change
- subset sum
- 0-1 knapsack
- edit distance
- longest increasing subsequence (LIS)
- longest common subsequence (LCS)
- LCS reduced to LIS
- longest palindromic subsequence (LPS)
- traveling salesman problem (TSP)
- matrix chain multiplication (MCM)
- rod cutting
🌍 graphs
- data structures representation
- traversal
- depth-first search (DFS)
- breadth-first search (BFS)
- flood fill
- edge classification
- bridges and articulations points
- strongly connected components (SCC)
- topological sorting
- kahn
- naive
- minimum spanning tree (MST)
- kruskal
- variants
- minimax path
- network flow
- max flow w/ edmonds karp
- min cost max flow
- shortest path
- single-source
- bellman ford
- dijkstra
- single-source
- specials
- bipartite graph
- bipartite checking
- maximum cardinality bipartite matching
- directed acyclic graph
- tree
- heavy-light decomposition (HLD)
- lowest common ancestor (LCA)
- binary lifting
- eulerian tour
- bipartite graph
✏️ math
- number theory
- fast exponentiation
- prime numbers
- prime checking
- sieve of eratosthenes
- modified sieve
- optimized prime checking
- prime factors of n
- prime factors of n!
- number of divisors of n
- sum of divisors of n
- matrix exponentiation
- linear recurrences
- utility in graph
- utility in counting
- linear recurrences
💭 miscellaneous
- binary search
- bitmasks
- two pointers
References
- HALIM, Steven. "Competitive Programming 3: The new lower bound of programming contests".