Concepts23

⚙️AlgorithmIntermediate

State Space Reduction

State space reduction shrinks the number of dynamic programming or search states by keeping only the information that truly affects future decisions.

#state space reduction#dynamic programming#equivalence relation+12
📚TheoryIntermediate

Bellman Equations

Bellman equations express how the value of a state or action equals immediate reward plus discounted value of what follows.

#bellman equation#value iteration#policy iteration+12
MathIntermediate

Derangements

A derangement is a permutation with no element left in its original position, often written as !n or D(n).

#derangement#subfactorial#inclusion-exclusion+11
MathIntermediate

Stars and Bars

Stars and Bars counts the ways to distribute n identical items into k distinct bins using combinations.

#stars and bars#combinatorics#binomial coefficient+12
MathIntermediate

Permutations and Combinations

Permutations count ordered selections, while combinations count unordered selections.

#permutations#combinations#binomial coefficient+12
⚙️AlgorithmIntermediate

Matrix Exponentiation

Matrix exponentiation turns repeated linear transitions into a single fast power of a matrix using exponentiation by squaring.

#matrix exponentiation#binary exponentiation#companion matrix+11
⚙️AlgorithmIntermediate

Exchange Arguments in DP

An exchange argument proves that any optimal solution can be reordered to satisfy a simple sorting rule by showing that swapping adjacent out-of-order elements never helps.

#exchange argument#adjacent swap#smith rule+12
⚙️AlgorithmIntermediate

Interval DP

Interval DP solves problems where the optimal answer for a segment [i, j] depends on answers of its subsegments.

#interval dp#matrix chain multiplication#burst balloons+12
⚙️AlgorithmIntermediate

Tree DP - Rerooting Technique

Rerooting (a.k.a. 换根 DP) computes a per-node answer as if each node were the root, in total O(n) time on trees.

#rerooting#tree dp#prefix suffix+11
⚙️AlgorithmIntermediate

Digit DP

Digit DP is a dynamic programming technique for counting or aggregating values over all integers in a range that satisfy a digit-based property.

#digit dp#dynamic programming#tight constraint+12
⚙️AlgorithmIntermediate

Tree DP - Matching and Covering

Tree DP solves matching, vertex cover, and independent set on trees in linear time using small state transitions per node.

#tree dp#maximum matching#vertex cover+12
⚙️AlgorithmIntermediate

Bitmask DP

Bitmask DP compresses the state of a subset of n elements into an integer mask, enabling elegant dynamic programming over all subsets.

#bitmask dp#subset dp#held-karp+12