Concepts19

βˆ‘MathIntermediate

Fast Exponentiation

Fast exponentiation (binary exponentiation) computes a^n using repeated squaring in O(log n) multiplications.

#binary exponentiation#fast power#modular exponentiation+11
βˆ‘MathIntermediate

Chinese Remainder Theorem

The Chinese Remainder Theorem (CRT) reconstructs an integer from its remainders modulo pairwise coprime moduli and guarantees a unique answer modulo the product.

#chinese remainder theorem#crt#modular arithmetic+12
βš™οΈAlgorithmAdvanced

NTT (Number Theoretic Transform)

The Number Theoretic Transform (NTT) is an FFT-like algorithm that performs discrete convolutions exactly using modular arithmetic instead of floating-point numbers.

#ntt#number theoretic transform#polynomial multiplication+11
βš™οΈAlgorithmIntermediate

String Hashing (Polynomial Hash)

Polynomial string hashing encodes a string as a base-p number modulo a large prime, letting us compare substrings in O(1) after O(n) preprocessing.

#string hashing#polynomial hash#rolling hash+12
βˆ‘MathAdvanced

Linear Recurrence

A linear recurrence defines each term as a fixed linear combination of a small, fixed number of previous terms.

#linear recurrence#matrix exponentiation#kitamasa+12
πŸ—‚οΈData StructureAdvanced

Aho-Corasick - DP Applications

Aho–Corasick (AC) turns a set of forbidden patterns into a finite automaton that lets you process or generate strings while tracking whether any pattern appears.

#aho-corasick#automaton dp#forbidden substrings+12
πŸ—‚οΈData StructureIntermediate

DSU with Weighted Edges

A DSU with weighted edges (also called a potential or difference-constraint union-find) maintains relative values between elements while still supporting near-constant-time merges and finds.

#dsu#union-find#weighted edges+11