- Geometry - point, line
- Dijkstra
- Bellman Ford
- Floyd Warshall
- Minimum Spanning Tree
- Topological Sort
- Eulerian Trail
- Strongly Connected Component
- Articulation Point
- Network Flow
- Maximum Bipartite Matching
- Lowest Common Ancestor
- Lazy Propagation
- Convex Hull
- KMP
- Persistent Segment Tree
- Heavy - Light Decomposition
- Segment Tree 2D
- Dynamic Segment Tree
- Dynamic Segment Tree 2D
- BigInteger
- Factorial(a) : returns a!.
- Factorial(a, Mod) : returns a! mod Mod.
- 0 ≤ a ≤ 2^31 - 1
- 0 ≤ Mod ≤ 2^63 - 1
- Best : O(a)
- Worst : O(a)
- Pow(a, b) : returns a ^ b.
- Pow(a, b, Mod) : returns a ^ b mod Mod.
- 0 ≤ a, b, Mod ≤ 2^63 - 1
- Best : O(log b)
- Worst : O(log b)
- PrefixSum
- init(vector A) : init Prefix Sum into A
- Query(l, r) : returns sum from lth value to rth value
- let N size of A
- 1 ≤ N ≤ 2^31 - 1
- init
- Best : O(N)
- Worst : O(N)
- Query
- Best : O(1)
- Worst : O(1)
- UnionFind
- Union(a, b) : Merge a, b and returns if a, b is in the different group
- Same(a, b) : returns if a, b is in the same group
- Count(x) : returns size of x's group.
- 1 ≤ N ≤ 2^31 - 1
- Union, Same, Count
- Best : O(log* N)
- Worst : O(log* N)
- FenwickTree
- Update(k, v) : add v in kth value.
- Query(l, r) : returns sum of lth value to rth value.
- 1 ≤ N ≤ 2^31 - 1
- 1 ≤ l, r, k ≤ N
- -2^63 ≤ v ≤ 2^63-1
- Update, Query
- Best : O(log N)
- Worst : O(log N)
- SegmentTree<Op, N>
- Update(k, v) : Update kth value with v
- Change(k, v) : Change kth value with v
- Query(l, r) : returns query from l to r
- Op should be one from '+'(plus), '*'(multiply), '|'(Bitwise OR), '&'(Bitwise AND), '|'(Bitwise OR)
- 1 ≤ N ≤ 2^31 - 1
- 1 ≤ l, r, k ≤ N
- -2^63 ≤ v ≤ 2^63-1
- Update, Change, Query
- Best : O(log N)
- Worst : O(log N)