Skip to content
Navigation
Algorithms for Competitive Programming
Prefix function - Knuth-Morris-Pratt
Search
Search
cp-algorithms/cp-algorithms
Algorithms for Competitive Programming
cp-algorithms/cp-algorithms
Home
Home
Main Page
Navigation
Tag index
How to Contribute
Code of conduct
Preview
Algebra
Algebra
Fundamentals
Fundamentals
Binary Exponentiation
Euclidean algorithm for computing the greatest common divisor
Extended Euclidean Algorithm
Linear Diophantine Equations
Fibonacci Numbers
Prime numbers
Prime numbers
Sieve of Eratosthenes
Linear Sieve
Primality tests
Integer factorization
Number-theoretic functions
Number-theoretic functions
Euler's totient function
Number of divisors / sum of divisors
Modular arithmetic
Modular arithmetic
Modular Inverse
Linear Congruence Equation
Chinese Remainder Theorem
Garner's Algorithm
Factorial modulo p
Discrete Log
Primitive Root
Discrete Root
Montgomery Multiplication
Number systems
Number systems
Balanced Ternary
Gray code
Miscellaneous
Miscellaneous
Bit manipulation
Enumerating submasks of a bitmask
Arbitrary-Precision Arithmetic
Fast Fourier transform
Operations on polynomials and series
Continued fractions
Factoring Exponentiation
Data Structures
Data Structures
Fundamentals
Fundamentals
Minimum Stack / Minimum Queue
Sparse Table