Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/ShahjalalShohag/code-library
/ functions
Functions
3,514 in github.com/ShahjalalShohag/code-library
⨍
Functions
3,514
◇
Types & classes
351
↓ 1 callers
Function
rec
Geometry/Delaunay Triangulation.cpp:60
↓ 1 callers
Method
reduced_row_echelon_form
https://en.wikipedia.org/wiki/Row_echelon_form#Reduced_row_echelon_form
Math/Basis Vector Reduced Row Echelon Form.cpp:30
↓ 1 callers
Function
rem
Data Structures/MOs on tree.cpp:32
↓ 1 callers
Function
resultant
Let n = deg(A), m = deg(B). Treat deg(0) = 0. a[n] != 0, b[m] != 0 R(A, B) := b[m]^n prod_{j=0..m-1} A(b_roots[j]) // counted with multiplicities = (-
Math/Determinant of Permutant Matrix.cpp:33
↓ 1 callers
Function
resultant
Let n = deg(A), m = deg(B). Treat deg(0) = 0. a[n] != 0, b[m] != 0 R(A, B) := b[m]^n prod_{j=0..m-1} A(b_roots[j]) // counted with multiplicities = (-
Math/Determinant of Cyclic Matrix.cpp:33
↓ 1 callers
Function
rev_permute
Number Theory/Sum of nCi for a Fixed Large n.cpp:117
↓ 1 callers
Method
reverse
reverse all the values from qL to qR
Data Structures/Implicit Treap.cpp:258
↓ 1 callers
Function
rho_pollard
Number Theory/Prime Factorization Fastest.cpp:65
↓ 1 callers
Method
rollback
Strings/Palindromic Tree Persistent.cpp:74
↓ 1 callers
Method
root
Math/Polynomial.cpp:338
↓ 1 callers
Method
rotateccw90
Geometry/Half Plane Intersection Dynamic.cpp:74
↓ 1 callers
Method
same
Data Structures/Persistent UnionFind.cpp:87
↓ 1 callers
Method
same
Data Structures/DSU Partially Persistent.cpp:18
↓ 1 callers
Method
same
Graph Theory/Krushkal's MST.cpp:12
↓ 1 callers
Function
seg_line_relation
intersection between segment ab and line cd 0 if do not intersect, 1 if proper intersect, 2 if segment intersect
Geometry/Geometry 2D.cpp:226
↓ 1 callers
Function
seg_seg_intersection
intersection point between segment ab and segment cd assuming unique intersection exists
Geometry/Voronoi Diagram.cpp:232
↓ 1 callers
Function
segmented_sieve
Generate all primes from l to r using segmented sieve in O((r - l) log (r) + sqrt(r))
Number Theory/Segmented Sieve.cpp:27
↓ 1 callers
Method
set
Data Structures/Persistent UnionFind.cpp:43
↓ 1 callers
Function
set_kth_bit
Sets the kth bit of x to 1 and returns the result
Basics/Bitwise Operations.cpp:41
↓ 1 callers
Method
set_par
Graph Theory/Directed MST.cpp:32
↓ 1 callers
Method
shl
Strings/Bit LCS.cpp:39
↓ 1 callers
Function
show_extended_sequence
Math/Linear Recurrence With Polynomial Coefficients.cpp:157
↓ 1 callers
Function
sieve
Generate all primes up to limit using sieve of eratosthenes
Number Theory/Segmented Sieve.cpp:7
↓ 1 callers
Function
sieve
Number Theory/K Divisors.cpp:17
↓ 1 callers
Function
sieve
polynomial representation of f(p)
Number Theory/Min_25 Sieve.cpp:51
↓ 1 callers
Function
sieve
Number Theory/Linear Sieve for Multiplicative Functions.cpp:9
↓ 1 callers
Function
sieve
Number Theory/nCr Modulo Any Mod.cpp:86
↓ 1 callers
Function
sieve
credit: min_25 takes 0.5s for n = 1e9
Number Theory/Sieve upto 1e9.cpp:6
↓ 1 callers
Function
sieve
Number Theory/Sieve Linear.cpp:8
↓ 1 callers
Function
sieve
Number Theory/Smallest Number Having Exactly K Divisors.cpp:17
↓ 1 callers
Function
sieve
Number Theory/Prime Counting Function.cpp:18
↓ 1 callers
Function
sieve
Number Theory/Sieve.cpp:30
↓ 1 callers
Function
sieve
Number Theory/Powerful Number Sieve.cpp:49
↓ 1 callers
Function
sieve_v0
use bitset<N> is_prime; to have O(N/64) memory complexity using bitset you can solve upto around N = 10^8 in 1s
Number Theory/Sieve.cpp:10
↓ 1 callers
Function
solve
Dynamic Programming Optimizations/Knuth Optimization.cpp:20
↓ 1 callers
Function
solve
number of solutions of the equation x0 xor x1 xor ... x(n - 1) = x s.t. 0 <= xi <= ai O(n * log(MAX))
Dynamic Programming Optimizations/XOR Equation.cpp:60
↓ 1 callers
Function
solve
number of solutions of the equation x0 xor x1 xor ... x(n - 1) = x s.t. 0 <= xi <= ai O(n * log(MAX))
Miscellaneous/XOR Equation Arbitrary Range.cpp:60
↓ 1 callers
Function
solve
Math/Integration (Simpsons).cpp:20
↓ 1 callers
Function
solve
Number of Perfect Matchings of a general graph SQRT of the Permanent of a zero diagonal symmetric matrix Takes ~2s for (38 * 38) matrix
Math/Hafnian of a Matrix.cpp:63
↓ 1 callers
Function
solve
Math/Simplex Algorithm.cpp:136
↓ 1 callers
Function
solve
Math/Basis Vector.cpp:105
↓ 1 callers
Function
solve
Game Theory/Alpha Beta Pruning.cpp:19
↓ 1 callers
Function
solve
Number Theory/Linear Diophantine Equation with N Variables.cpp:85
↓ 1 callers
Function
solve
sum of f(i) for 1 <= i <= n pol is the polynomial representation of f(p)
Number Theory/Min_25 Sieve.cpp:116
↓ 1 callers
Function
solve
Number Theory/Dirichlet Convolution.cpp:77
↓ 1 callers
Function
solve
\sum{x=0}^{n}{x^k1 * ((ax + b)/c)^k2} //floor division 0^0 = 1 it solves for all _k1, _k2 s.t. _k1 + _k2 <= k1 + k2 (a * n + b) should fit in long lon
Number Theory/Generalized Floor Sum of Arithmetic Progressions.cpp:108
↓ 1 callers
Function
solve
\sum{x=0}^{n}{x^k1 * ((ax + b)/c)^k2} //floor division 0^0 = 1 it solves for all _k1, _k2 s.t. _k1 + _k2 <= k1 + k2 (a * n + b) should fit in long lon
Number Theory/Sum of Arithmetic Progression Powers Divided.cpp:107
↓ 1 callers
Function
solve
Computes sum_{k=0}^{n-1} x^{(a*k + b) % m} % mod
Number Theory/Sqrt Decomposition of Mod of Arithmetic Progression.cpp:139
↓ 1 callers
Function
solve
credit: Min_25
Number Theory/Sum of nCi for a Fixed Large n.cpp:596
↓ 1 callers
Function
solve
Number Theory/Powerful Number Sieve.cpp:90
↓ 1 callers
Function
solve
Data Structures/MOs with DSU.cpp:140
↓ 1 callers
Function
solve
Graph Theory/Euler Path Undirected.cpp:28
↓ 1 callers
Function
solve
Graph Theory/Edge Coloring Simple Graph.cpp:19
↓ 1 callers
Function
solve
Graph Theory/Edge Coloring Bipartite Graph.cpp:30
↓ 1 callers
Function
solve
Graph Theory/Euler Path Directed.cpp:20
↓ 1 callers
Function
solve
Graph Theory/Dynamic MST Offline.cpp:56
↓ 1 callers
Method
solve
Math/Reeds Sloane Algorithm.cpp:188
↓ 1 callers
Method
solve
Graph Theory/Stoer Wagner Algorithm.cpp:25
↓ 1 callers
Method
solve
Number of Perfect Matchings of a general graph SQRT of the Permanent of a zero diagonal symmetric matrix Takes ~2s for (38 * 38) matrix
Graph Theory/Hafnian of a Matrix.cpp:63
↓ 1 callers
Method
solve
returns {maxflow, mincost}
Graph Theory/Min Cost Max Flow.cpp:93
↓ 1 callers
Method
solve
Graph Theory/Maximum Clique and Maximum Independent Set Super Fast.cpp:67
↓ 1 callers
Method
solve
returns edge chromatic number, ans contains the edge coloring(colors are 1 indexed) supports multiple edges 0 indexed, O(M log M)
Graph Theory/Edge Coloring Bipartite Graph Faster.cpp:152
↓ 1 callers
Method
solve
Graph Theory/Maximum Closure Problem.cpp:107
↓ 1 callers
Method
solve
Graph Theory/Blossom Algorithm Weighted.cpp:202
↓ 1 callers
Method
solve0
Game Theory/Blue Red Hackenbush.cpp:99
↓ 1 callers
Method
solve1
Game Theory/Blue Red Hackenbush.cpp:105
↓ 1 callers
Function
spfa
Graph Theory/Minimum Mean Weight Cycle.cpp:9
↓ 1 callers
Function
spfa
Graph Theory/System Of Difference Constraints.cpp:35
↓ 1 callers
Method
splay
Data Structures/Top Tree.cpp:262
↓ 1 callers
Method
splay_2
Data Structures/Top Tree.cpp:218
↓ 1 callers
Method
splay_dir
Data Structures/Top Tree.cpp:209
↓ 1 callers
Method
splay_vert
Data Structures/Top Tree.cpp:239
↓ 1 callers
Method
sqrt
Number Theory/Prime Number System.cpp:57
↓ 1 callers
Function
squared_distance
Data Structures/KD Tree.cpp:39
↓ 1 callers
Function
st_numbering
Graph Theory/ST Numbering.cpp:49
↓ 1 callers
Function
stirling
returns stirling1st(n, i) for 0 <= i <= n
Number Theory/Stirling Number of the First Kind for Fixed n.cpp:86
↓ 1 callers
Function
stirling
stirling2nd(i, k) for 0 <= i <= n O(n log^2 n)
Number Theory/Stirling Number of the Second Kind for Fixed k.cpp:279
↓ 1 callers
Function
stirling
returns stirling1st(i, k) for 0 <= i < n O(n log^2 n)
Number Theory/Stirling Number of the First Kind for Fixed k.cpp:64
↓ 1 callers
Function
string_matching
find occurrences of t in s where '?'s are automatically matched with any character res[i + m - 1] = sum_j=0 to m - 1_{s[i + j] * t[j] * (s[i + j] - t[
Strings/String Matching With FFT.cpp:59
↓ 1 callers
Method
sub
Strings/Bit LCS.cpp:32
↓ 1 callers
Function
subset_sum
if sum of the array values = x, then complexity is O(x sqrt(x)) returns the subset ids
Dynamic Programming Optimizations/Subset Sum in SQRT.cpp:8
↓ 1 callers
Function
subset_sum
if sum of the array values = x, then complexity is O(x sqrt(x))
Graph Theory/Tree Orientation.cpp:27
↓ 1 callers
Function
subset_sum_convolution
f*g(s)=sum_{s' $ s} {F(s')*G(s\s')} O(B * B * 2 ^ B)
Dynamic Programming Optimizations/SOS convolutions.cpp:53
↓ 1 callers
Method
substr
Math/Faulhaber Formula Fastest.cpp:192
↓ 1 callers
Function
suffix_array
Strings/Suffix Array.cpp:80
↓ 1 callers
Function
suffix_array_DA
Strings/Suffix Array Isomorphic.cpp:12
↓ 1 callers
Method
sum
sum of numbers in [l ,r] less than or equal to k
Data Structures/Wavelet Tree.cpp:73
↓ 1 callers
Function
sum_sigma0
credit: zimpha compute \sum_{i=1}^{n} sigma0(i) in ~O(n^{1/3}) time. it is also equal to \sum_{i=1}^{n} floor(n / i) takes ~100 ms for n = 1e18
Number Theory/Sum of The Number of Divisors in cbrt(n).cpp:12
↓ 1 callers
Function
sumsq
Number Theory/Linear Diophantine Equation Three Variables with Nonnegative Solutions.cpp:22
↓ 1 callers
Function
sweepline
Geometry/Point Location.cpp:47
↓ 1 callers
Function
tangents_from_point_to_polygon
(ccw, cw) tangents from a point that is outside this convex polygon returns indexes of the points ccw means the tangent from Q to that point is in the
Geometry/Geometry 2D.cpp:926
↓ 1 callers
Function
toggle_kth_bit
Toggles the kth bit of x and returns the result
Basics/Bitwise Operations.cpp:51
↓ 1 callers
Function
totient
Number Theory/Primitive Root.cpp:4
↓ 1 callers
Function
totient
Number Theory/Multiplicative Order.cpp:14
↓ 1 callers
Method
traverse
Strings/Aho Corasick All Pair Occurrence Relation.cpp:54
↓ 1 callers
Method
truncate
Geometry/All Pair Segment Intersection.cpp:59
↓ 1 callers
Method
truncate
Data Structures/Square Root Decomposition With Reverse Update.cpp:36
↓ 1 callers
Method
unit
Geometry/Geometry 3D.cpp:68
↓ 1 callers
Method
unite
Data Structures/Dynamic Connectivity Problem.cpp:49
↓ 1 callers
Method
unite
Data Structures/MOs with DSU.cpp:67
← previous
next →
1,301–1,400 of 3,514, ranked by callers