Concepts5
⚙️AlgorithmIntermediate
Double Counting
Double counting is the strategy of counting the same quantity in two different ways to derive an equality or an efficient algorithm.
#double counting#contribution technique#handshake lemma+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
Inclusion-Exclusion Principle
The Inclusion-Exclusion Principle (IEP) corrects overcounting by alternately adding and subtracting sizes of intersections of sets.
#inclusion-exclusion#derangements#surjections+12
∑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
⚙️AlgorithmIntermediate
2D Prefix Sum
A 2D prefix sum (also called an integral image) lets you compute the sum of any axis-aligned sub-rectangle in constant time after O(nm) preprocessing.
#2d prefix sum#summed-area table#integral image+12