Concepts113

⚙️AlgorithmAdvanced

Convex Hull Trick (CHT)

The Convex Hull Trick (CHT) speeds up dynamic programs where each state is a minimum over linear functions, such as dp[i] = min_j (dp[j] + b[j] × a[i]).

#convex hull trick#cht#dynamic programming optimization+12
⚙️AlgorithmAdvanced

Knuth Optimization

Knuth Optimization speeds up a class of interval dynamic programming (DP) from O(n^3) to O(n^2) by exploiting the monotonicity of optimal split points.

#knuth optimization#interval dp#quadrangle inequality+12
⚙️AlgorithmAdvanced

Digit DP - Advanced States

Digit DP counts integers in a range by scanning digits from most significant to least while maintaining compact state information.

#digit dp#tight flag#leading zeros+12
⚙️AlgorithmAdvanced

DP with Probability

DP with probability models how chance flows between states over time by repeatedly redistributing mass according to transition probabilities.

#markov chain#probability dp#absorbing state+12
⚙️AlgorithmAdvanced

Sum over Subsets (SOS) DP

Sum over Subsets (SOS) DP lets you compute F[mask] = sum of A[submask] over all submasks in O(n 2^n) instead of O(3^n).

#sos dp#subset zeta transform#mobius inversion+11
⚙️AlgorithmAdvanced

DP with Expected Value

Dynamic programming with expected value solves problems where each state transitions randomly and we seek the expected cost, time, or steps to reach a goal.

#expected value dp#linearity of expectation#indicator variables+11
MathAdvanced

Game Theory - Advanced Games

Sprague–Grundy (SG) theory solves impartial, normal-play, terminating games by assigning each position a nonnegative integer called its Grundy value.

#sprague-grundy#grundy number#nim-sum+12
MathAdvanced

Berlekamp-Massey Algorithm

Berlekamp–Massey (BM) finds the shortest linear recurrence that exactly fits a given sequence over a field (e.g., modulo a prime).

#berlekamp-massey#linear recurrence#minimal polynomial+11
MathAdvanced

Gaussian Elimination over GF(2)

Gaussian elimination over GF(2) is ordinary Gaussian elimination where addition and subtraction are XOR and multiplication is AND.

#gaussian elimination#gf(2)#xor basis+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
⚙️AlgorithmAdvanced

Block-Cut Tree

A Block-Cut Tree decomposes an undirected graph into biconnected components (blocks) and articulation points, forming a bipartite tree.

#block-cut tree#biconnected components#articulation points+11
⚙️AlgorithmAdvanced

Hungarian Algorithm

The Hungarian algorithm solves the square assignment problem (matching n workers to n jobs) in O(n^{3}) time using a clever potential (label) function on vertices.

#hungarian algorithm#assignment problem#bipartite matching+11