Concepts10

⚙️AlgorithmIntermediate

Overflow Prevention Techniques

Integer overflow happens when a computed value exceeds the range of its type; in C++ this silently wraps for unsigned and is undefined for signed, so prevention is crucial.

#overflow prevention#long long#__int128+11
MathIntermediate

Linear Diophantine Equations

A linear Diophantine equation ax + by = c has integer solutions if and only if gcd(a, b) divides c.

#linear diophantine#extended euclidean algorithm#gcd+12
MathIntermediate

Euler's Totient Function

Euler's Totient Function φ(n) counts how many integers from 1 to n are coprime with n.

#euler totient#phi function#coprime count+12
MathIntermediate

Modular Arithmetic Basics

Modular arithmetic is arithmetic with wrap-around at a fixed modulus m, like numbers on a clock.

#modular arithmetic#mod#modulo c+++12
MathIntermediate

Modular Inverse

A modular inverse of a modulo m is a number a_inv such that a × a_inv ≡ 1 (mod m).

#modular inverse#extended euclidean algorithm#fermats little theorem+12
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
MathIntermediate

Prime Factorization

Prime factorization expresses any integer greater than 1 as a product of primes raised to powers, uniquely up to ordering.

#prime factorization#trial division#spf sieve+12
MathIntermediate

Extended Euclidean Algorithm

The Extended Euclidean Algorithm finds integers x and y such that ax + by = gcd(a, b) while also computing gcd(a, b).

#extended euclidean algorithm#bezout coefficients#gcd+12
MathIntermediate

GCD and Euclidean Algorithm

The greatest common divisor (gcd) of two integers is the largest integer that divides both without a remainder.

#gcd#euclidean algorithm#extended euclidean+12
🗂️Data StructureIntermediate

Sparse Table

A Sparse Table is a static range-query data structure that preprocesses an array in O(n \log n) time and answers many queries in O(1) time.

#sparse table#range minimum query#rmq+12