MCPcopy Create free account

hub / github.com/ShahjalalShohag/code-library / functions

Functions3,514 in github.com/ShahjalalShohag/code-library

↓ 1 callersFunctionCRT
finds x such that x % m1 = a1, x % m2 = a2. m1 and m2 may not be coprime here, x is unique modulo m = lcm(m1, m2). returns (x, m). on failure, m = -1.
Number Theory/Intersection of Arithmetic Progressions.cpp:21
↓ 1 callersFunctionCRT
find z such that z % x = a, z % y = b. here, z is unique modulo M = lcm(x,y). returns (z, M). on failure, M = -1.
Number Theory/Smallest Nonnegative Integer x s.t. l <= ax % p <= r.cpp:24
↓ 1 callersFunctionCRT
finds x such that x % m1 = a1, x % m2 = a2. m1 and m2 may not be coprime here, x is unique modulo m = lcm(m1, m2). returns (x, m). on failure, m = -1.
Number Theory/CRT.cpp:20
↓ 1 callersFunctionCRT
finds x such that x % m1 = a1, x % m2 = a2. m1 and m2 may not be coprime here, x is unique modulo m = lcm(m1, m2). returns (x, m). on failure, m = -1.
Number Theory/nCr Modulo Any Mod.cpp:75
↓ 1 callersFunctionDMST
returns parents of each vertex each edge should be distinct it assumes that a solution exists (all vertices are reachable from root) 0 indexed Takes ~
Graph Theory/Directed MST.cpp:39
↓ 1 callersFunctionDeterminant
O(n^2 + n*k) where k is the number of non-zero elements
Math/Determinant of Sparse Matrix.cpp:165
↓ 1 callersFunctionEppstein
Graph Theory/Eppsteins Algorithm.cpp:45
↓ 1 callersFunctionFreivalds
check if two n*n matrix a*b=c within complexity (iteration*n^2) probability of error 2^(-iteration)
Math/Freivalds Algorithm.cpp:69
↓ 1 callersFunctionGauss
Math/Gaussian Elimination Modular.cpp:15
↓ 1 callersFunctionGauss
n = number of equations, m = number of variables
Math/Gaussian Elimination Modulo 2.cpp:7
↓ 1 callersFunctionGauss
Math/Determinant.cpp:7
↓ 1 callersFunctionGauss
O(n^3 logn)
Math/Determinant under Composite Modulo.cpp:7
↓ 1 callersFunctionGauss
Math/Inverse of A Matrix.cpp:14
↓ 1 callersFunctionGauss
Math/Gaussian Elimination.cpp:7
↓ 1 callersFunctionGauss
Math/Determinant under Prime Modulo.cpp:15
↓ 1 callersFunctionHessenberg
transformtation: a(i, j) = 0 for i > j + 1
Math/Characteristic Polynomial Faster.cpp:35
↓ 1 callersFunctionKruskal
Graph Theory/Manhattan MST.cpp:42
↓ 1 callersMethodLTE
count of numbers in [l, r] Less than or equal to k
Data Structures/Wavelet Tree.cpp:57
↓ 1 callersFunctionLagrange
generates the polynomial explicitely
Math/Characteristic Polynomial Faster.cpp:82
↓ 1 callersFunctionLagrange
generates the polynomial explicitely
Math/Lagrange Interpolation Brute.cpp:41
↓ 1 callersFunctionLagrange
p = first at least n + 1 points: a, a+d, ..., a+n*d of the n degree polynomial, returns f(x)
Math/Lagrange Interpolation.cpp:41
↓ 1 callersFunctionLagrange
takes 0.8sec for n = 100000 Extracts the polynomial explicitely
Math/Lagrange Interpolation with Polynomial Extraction.cpp:196
↓ 1 callersFunctionLagrange
generates the polynomial explicitely
Number Theory/Generalized Floor Sum of Arithmetic Progressions.cpp:47
↓ 1 callersFunctionLagrange
generates the polynomial explicitely
Number Theory/Sum of Arithmetic Progression Powers Divided.cpp:46
↓ 1 callersFunctionLehmer
runs under 0.5s for n = 1e12
Number Theory/K Divisors.cpp:58
↓ 1 callersFunctionLehmer
runs under 0.2s for n = 1e12
Number Theory/Prime Counting Function.cpp:59
↓ 1 callersFunctionLinearRecurrence
Math/Linear Recurrence Fastest.cpp:102
↓ 1 callersFunctionLinearRecurrence
transition -> for(i = 0; i < x; i++) f[n] += tr[i] * f[n-i-1] S contains initial values, k is 0 indexed
Math/BerleKamp Massey.cpp:71
↓ 1 callersFunctionLinearRecurrence
transition -> for(i = 0; i < x; i++) f[n] += tr[i] * f[n-i-1] S contains initial values, k is 0 indexed
Math/Linear Recurrence.cpp:54
↓ 1 callersFunctionMST
Graph Theory/Steiner Tree Problem.cpp:18
↓ 1 callersFunctionManhattan
Graph Theory/Manhattan MST.cpp:57
↓ 1 callersFunctionPEO
each node should be unique in the adjacency list
Graph Theory/Chordal Graph.cpp:21
↓ 1 callersFunctionPOW
Math/FWHT.cpp:6
↓ 1 callersFunctionPOW
Math/Polynomial with Binomial Coefficients.cpp:102
↓ 1 callersFunctionPrims
Graph Theory/Prim's MST.cpp:6
↓ 1 callersFunctionQuery
Dynamic Programming Optimizations/Persistent Li Chao Tree.cpp:51
↓ 1 callersFunctionSA_IS
Strings/Suffix Array.cpp:32
↓ 1 callersFunctionSM
Graph Theory/Stable Marriage Problem.cpp:15
↓ 1 callersFunctionSQRT
find sqrt(a) % p, i.e. find any x such that x^2 = a (mod p) if a solution exist, then if a == 0 or p == 2, there are 1 solution, otherwise, there are
Number Theory/Tonelli Shanks Algorithm.cpp:19
↓ 1 callersFunctionTEC
0 indexed returns the list of the three edge connected components O(n)
Graph Theory/Three Edge Connectivity.cpp:45
↓ 1 callersFunctionThomas
n equations of form: a_i*x_{i-1}+b_i*x_i+c_i*x_{i+1}=d_i, for i=1 to n where a_1=0,c_n=0 matrix form: b1 c1 0 0 0 | x1 d1 a2 b2 c2 0 0 |
Math/Thomas Algorithm.cpp:49
↓ 1 callersFunctionThomas
thomas algorithm for solving tri-diagonal system of equations
Math/The Slime Trick.cpp:35
↓ 1 callersFunction_triangle_circle_intersection
returns the area of the intersection of the circle with center c and radius r and the triangle formed by the points c, a, b
Geometry/Geometry 2D.cpp:1132
↓ 1 callersFunctionadd
Math/Lagrange Interpolation with Polynomial Extraction.cpp:165
↓ 1 callersFunctionadd
possible points that can be generated are of the form (a * m, b * m + k * coeff) add (a[i], b[i])
Number Theory/Linear Diophantine With N Unknowns and Two Equations.cpp:27
↓ 1 callersFunctionadd
Number Theory/Powerful Number Sieve.cpp:35
↓ 1 callersFunctionadd
Data Structures/MOs on tree.cpp:28
↓ 1 callersMethodadd
add x * b^e to this number: x, e both can be negative O(log_b(n)^2 / K) amortized
Miscellaneous/Trygub Num.cpp:15
↓ 1 callersMethodadd
Data Structures/4D MO.cpp:13
↓ 1 callersMethodadd
Graph Theory/Directed MST.cpp:14
↓ 1 callersFunctionadd2
w[u][v]++, w[v][u]++, deg[u]++,deg[v]++
Graph Theory/Kirchoffs Theorem.cpp:78
↓ 1 callersMethodadd_arithmetic_progression
Miscellaneous/Maximum of Sum of All Pair Distances of K nodes in a Tree.cpp:99
↓ 1 callersFunctionadd_edge
Graph Theory/Minimum Mean Weight Cycle.cpp:31
↓ 1 callersMethodadd_edge
Strings/Aho Corasick All Pair Occurrence Relation.cpp:77
↓ 1 callersMethodadd_edge
Game Theory/Matching Game On A Graph.cpp:22
↓ 1 callersMethodadd_edge
Graph Theory/Randomized Matching Unweighted.cpp:21
↓ 1 callersMethodadd_edge
Graph Theory/Dinics Algorithm.cpp:23
↓ 1 callersMethodadd_edge
Graph Theory/Hungarian Algorithm.cpp:24
↓ 1 callersMethodadd_edge
Graph Theory/Stoer Wagner Algorithm.cpp:19
↓ 1 callersMethodadd_edge
Graph Theory/DAG Reachability Dynamic.cpp:19
↓ 1 callersMethodadd_edge
Graph Theory/HopCroft Karp Algorithm.cpp:19
↓ 1 callersMethodadd_edge
Graph Theory/Kuhns Algorithm.cpp:19
↓ 1 callersMethodadd_edge
Graph Theory/Online Articulation Bridges.cpp:96
↓ 1 callersMethodadd_edge
Graph Theory/Gomory Hu Tree.cpp:23
↓ 1 callersMethodadd_edge
Graph Theory/Blossom Algorithm.cpp:22
↓ 1 callersMethodadd_edge
Graph Theory/Blossom Algorithm Weighted.cpp:32
↓ 1 callersMethodadd_element
Number Theory/Prime Basis.cpp:60
↓ 1 callersMethodadd_pattern
Strings/Aho Corasick.cpp:24
↓ 1 callersMethodadd_val
range add query
Data Structures/Segment Tree Beats.cpp:252
↓ 1 callersMethodadd_word
Strings/Aho Corasick Dynamic.cpp:88
↓ 1 callersMethodadvance
Strings/Aho Corasick.cpp:48
↓ 1 callersFunctionany_intersection
returns any pair of segments such that they intersect
Geometry/All Pair Segment Intersection.cpp:151
↓ 1 callersFunctionapproximate
Number Theory/Rational Approximation.cpp:11
↓ 1 callersFunctionarea
Geometry/Maximum Area of Triangle, Given are Lengths.cpp:9
↓ 1 callersFunctionarea
Geometry/Geometry 2D.cpp:573
↓ 1 callersFunctionarea
Geometry/Half Plane Intersection.cpp:50
↓ 1 callersMethodarea
Geometry/Half Plane Intersection Dynamic.cpp:125
↓ 1 callersFunctionarea_on_the_surface_of_the_sphere
Assume that the sphere is centered at the origin the polygon is simple and given in counterclockwise order for each consecutive pair of points, the co
Geometry/Geometry 3D.cpp:639
↓ 1 callersMethodarg
Geometry/Geometry 2D.cpp:28
↓ 1 callersFunctionaugment
try to increment the size of the independent set implementation details: https://codeforces.com/blog/entry/69287#:~:text=Implementation%20and%20comple
Miscellaneous/Matroid Intersection Color Graphic Matroid.cpp:125
↓ 1 callersFunctionbell
Number Theory/Bell Number.cpp:263
↓ 1 callersFunctionbellman_ford
Graph Theory/Johnson's Algorithm.cpp:18
↓ 1 callersMethodbfs
it finds an augmented path starting from u
Game Theory/Matching Game On A Graph.cpp:58
↓ 1 callersMethodbfs
it finds an augmented path starting from u
Graph Theory/Blossom Algorithm.cpp:58
↓ 1 callersFunctionbinarize
Data Structures/Centroid Decomposition Persistent.cpp:11
↓ 1 callersFunctionbinarize
Data Structures/Binarizing a Tree.cpp:11
↓ 1 callersFunctionbinomial_sum_mod_p
Number Theory/Sum of nCi for a Fixed Large n.cpp:444
↓ 1 callersFunctionboundedKnapsack
ps-profits ws-weights ms-maximum limit of each element W-maximum weight O(n*W)
Dynamic Programming Optimizations/Bounded Knapsack.cpp:9
↓ 1 callersFunctionbrute
Number Theory/Linear Diophantine Equation Three Variables with Nonnegative Solutions.cpp:78
↓ 1 callersFunctionbrute
generate all powerful numbers and add up the results params: current prime index, current number generated, and h(m)
Number Theory/Powerful Number Sieve.cpp:74
↓ 1 callersFunctionbuild
creating a treap for string s in O(n)
Data Structures/Treap persistent.cpp:83
↓ 1 callersFunctionbuild
Data Structures/Reachability Tree.cpp:60
↓ 1 callersFunctionbuild
Data Structures/Sparse Table 2D.cpp:19
↓ 1 callersFunctionbuild
Graph Theory/Dijkstra on Segment Tree.cpp:11
↓ 1 callersMethodbuild
Miscellaneous/MEX of all Subarrays.cpp:9
↓ 1 callersMethodbuild
Math/Polynomial.cpp:462
↓ 1 callersMethodbuild
Strings/Suffix Automaton.cpp:75
↓ 1 callersMethodbuild
Data Structures/Segment Tree NonRecursive.cpp:25
↓ 1 callersMethodbuild
Data Structures/Segment Tree Persistent.cpp:13
↓ 1 callersMethodbuild
Data Structures/Segment Tree with Arithmetic Progression.cpp:61
← previousnext →701–800 of 3,514, ranked by callers