Concepts204
Category
GCD and Euclidean Algorithm
The greatest common divisor (gcd) of two integers is the largest integer that divides both without a remainder.
Randomized Algorithms
Randomized algorithms use coin flips (random bits) to guide choices, often making code simpler and fast on average.
Matrix Exponentiation
Matrix exponentiation turns repeated linear transitions into a single fast power of a matrix using exponentiation by squaring.
Small-to-Large Merging
Small-to-large merging is a technique where you always merge the smaller container into the larger one to guarantee low total work.
Mo's Algorithm
Mo's algorithm answers many range queries offline by reordering them to minimize pointer movement along the array.
Pick's Theorem
Pick's Theorem connects area and lattice-point counts for any simple polygon with integer-coordinate vertices.
Meet in the Middle
Meet-in-the-middle splits a hard exponential search into two halves, enumerates each half, and then combines results efficiently.
Closest Pair of Points
The closest pair of points problem asks for the minimum Euclidean distance between any two points in the plane.
Line Sweep
Line sweep (plane sweep) is a technique that processes geometric objects by moving an imaginary line and handling events in sorted order.
Polygon Area and Centroid
The signed area of a simple polygon can be computed in O(n) using the shoelace formula, which sums cross products of consecutive vertices.
Rotating Calipers
Rotating calipers is a geometric two-pointer technique that sweeps two (or more) parallel support lines around a convex polygon.
Basic Geometry - Lines and Segments
A line can be represented by two points, a point with a direction vector, or the general form ax + by + c = 0, and these forms are interconvertible.