Every formula, fact and complexity bound from the guide on one page, organised by syllabus section, for last-week revision. Each section links back to the full pages.
Probability and statistics
Counting — n ! n! n ! · n P r = n ! ( n − r ) ! ^nP_r = \tfrac{n!}{(n-r)!} n P r = ( n − r )! n ! · ( n r ) = n ! r ! ( n − r ) ! \binom nr = \tfrac{n!}{r!(n-r)!} ( r n ) = r ! ( n − r )! n ! · repetition allowed: ( n + r − 1 r ) \binom{n+r-1}{r} ( r n + r − 1 ) · derangements D n = n ! ∑ k = 0 n ( − 1 ) k k ! D_n = n!\sum_{k=0}^n\tfrac{(-1)^k}{k!} D n = n ! ∑ k = 0 n k ! ( − 1 ) k · inclusion–exclusion ∣ A ∪ B ∣ = ∣ A ∣ + ∣ B ∣ − ∣ A ∩ B ∣ |A\cup B| = |A| + |B| - |A\cap B| ∣ A ∪ B ∣ = ∣ A ∣ + ∣ B ∣ − ∣ A ∩ B ∣ .
Rules — P ( A ∪ B ) = P ( A ) + P ( B ) − P ( A ∩ B ) P(A\cup B) = P(A) + P(B) - P(A\cap B) P ( A ∪ B ) = P ( A ) + P ( B ) − P ( A ∩ B ) · P ( A ∣ B ) = P ( A ∩ B ) P ( B ) P(A\mid B) = \tfrac{P(A\cap B)}{P(B)} P ( A ∣ B ) = P ( B ) P ( A ∩ B ) · independent: P ( A ∩ B ) = P ( A ) P ( B ) P(A\cap B) = P(A)P(B) P ( A ∩ B ) = P ( A ) P ( B ) · total probability P ( B ) = ∑ i P ( B ∣ A i ) P ( A i ) P(B) = \sum_i P(B\mid A_i)P(A_i) P ( B ) = ∑ i P ( B ∣ A i ) P ( A i ) · Bayes P ( A i ∣ B ) = P ( B ∣ A i ) P ( A i ) ∑ j P ( B ∣ A j ) P ( A j ) P(A_i\mid B) = \tfrac{P(B\mid A_i)P(A_i)}{\sum_j P(B\mid A_j)P(A_j)} P ( A i ∣ B ) = ∑ j P ( B ∣ A j ) P ( A j ) P ( B ∣ A i ) P ( A i ) .
Expectation and variance — E [ a X + b ] = a E [ X ] + b E[aX + b] = aE[X] + b E [ a X + b ] = a E [ X ] + b · Var ( X ) = E [ X 2 ] − ( E [ X ] ) 2 \text{Var}(X) = E[X^2] - (E[X])^2 Var ( X ) = E [ X 2 ] − ( E [ X ] ) 2 · Var ( a X + b ) = a 2 Var ( X ) \text{Var}(aX + b) = a^2\text{Var}(X) Var ( a X + b ) = a 2 Var ( X ) · Var ( X + Y ) = Var X + Var Y + 2 Cov ( X , Y ) \text{Var}(X + Y) = \text{Var}X + \text{Var}Y + 2\text{Cov}(X, Y) Var ( X + Y ) = Var X + Var Y + 2 Cov ( X , Y ) · Cov ( X , Y ) = E [ X Y ] − E [ X ] E [ Y ] \text{Cov}(X, Y) = E[XY] - E[X]E[Y] Cov ( X , Y ) = E [ X Y ] − E [ X ] E [ Y ] · ρ = Cov σ X σ Y ∈ [ − 1 , 1 ] \rho = \tfrac{\text{Cov}}{\sigma_X\sigma_Y} \in [-1, 1] ρ = σ X σ Y Cov ∈ [ − 1 , 1 ] .
Distribution PMF / PDF Mean Variance Bernoulli(p p p ) p x ( 1 − p ) 1 − x p^x(1-p)^{1-x} p x ( 1 − p ) 1 − x p p p p ( 1 − p ) p(1-p) p ( 1 − p ) Binomial(n , p n, p n , p ) ( n x ) p x ( 1 − p ) n − x \binom nx p^x(1-p)^{n-x} ( x n ) p x ( 1 − p ) n − x n p np n p n p ( 1 − p ) np(1-p) n p ( 1 − p ) Geometric(p p p ), trials to 1st success ( 1 − p ) x − 1 p (1-p)^{x-1}p ( 1 − p ) x − 1 p 1 / p 1/p 1/ p ( 1 − p ) / p 2 (1-p)/p^2 ( 1 − p ) / p 2 Poisson(λ \lambda λ ) e − λ λ x / x ! e^{-\lambda}\lambda^x/x! e − λ λ x / x ! λ \lambda λ λ \lambda λ Uniform(a , b a, b a , b ) 1 b − a \tfrac1{b-a} b − a 1 a + b 2 \tfrac{a+b}2 2 a + b ( b − a ) 2 12 \tfrac{(b-a)^2}{12} 12 ( b − a ) 2 Exponential(λ \lambda λ ) λ e − λ x \lambda e^{-\lambda x} λ e − λ x 1 / λ 1/\lambda 1/ λ 1 / λ 2 1/\lambda^2 1/ λ 2 Normal(μ , σ 2 \mu, \sigma^2 μ , σ 2 ) 1 σ 2 π e − ( x − μ ) 2 / 2 σ 2 \tfrac1{\sigma\sqrt{2\pi}}e^{-(x-\mu)^2/2\sigma^2} σ 2 π 1 e − ( x − μ ) 2 /2 σ 2 μ \mu μ σ 2 \sigma^2 σ 2
Memoryless: geometric and exponential. Normal: 68–95–99.7 rule; z = ( x − μ ) / σ z = (x - \mu)/\sigma z = ( x − μ ) / σ ; z 0.025 = 1.96 z_{0.025} = 1.96 z 0.025 = 1.96 , z 0.05 = 1.645 z_{0.05} = 1.645 z 0.05 = 1.645 .
Inference — X ˉ ∼ N ( μ , σ 2 / n ) \bar X \sim N(\mu, \sigma^2/n) X ˉ ∼ N ( μ , σ 2 / n ) (CLT) · standard error σ / n \sigma/\sqrt n σ / n · CI x ˉ ± z α / 2 σ / n \bar x \pm z_{\alpha/2}\sigma/\sqrt n x ˉ ± z α /2 σ / n (use t n − 1 t_{n-1} t n − 1 and s s s when σ \sigma σ unknown) · sample variance s 2 = 1 n − 1 ∑ ( x i − x ˉ ) 2 s^2 = \tfrac1{n-1}\sum(x_i - \bar x)^2 s 2 = n − 1 1 ∑ ( x i − x ˉ ) 2 · z = x ˉ − μ 0 σ / n z = \tfrac{\bar x - \mu_0}{\sigma/\sqrt n} z = σ / n x ˉ − μ 0 · t = x ˉ − μ 0 s / n t = \tfrac{\bar x - \mu_0}{s/\sqrt n} t = s / n x ˉ − μ 0 · χ 2 = ∑ ( O − E ) 2 E \chi^2 = \sum\tfrac{(O - E)^2}{E} χ 2 = ∑ E ( O − E ) 2 · Type I error = α = \alpha = α , Type II = β = \beta = β , power = 1 − β = 1 - \beta = 1 − β .
Full pages: Probability & Statistics .
Linear algebra
Subspace: contains 0 \mathbf 0 0 , closed under + + + and scalar multiplication. Basis = linearly independent spanning set.
Rank–nullity : rank ( A ) + nullity ( A ) = n \text{rank}(A) + \text{nullity}(A) = n rank ( A ) + nullity ( A ) = n (number of columns). Row rank = column rank.
A x = b A\mathbf x = \mathbf b A x = b is consistent iff rank ( A ) = rank ( [ A ∣ b ] ) \text{rank}(A) = \text{rank}([A\mid\mathbf b]) rank ( A ) = rank ([ A ∣ b ]) ; unique iff also = n = n = n .
det ( A B ) = det A det B \det(AB) = \det A\det B det ( A B ) = det A det B · det ( A T ) = det A \det(A^T) = \det A det ( A T ) = det A · det ( k A ) = k n det A \det(kA) = k^n\det A det ( k A ) = k n det A · det ( A − 1 ) = 1 / det A \det(A^{-1}) = 1/\det A det ( A − 1 ) = 1/ det A · triangular: product of the diagonal.
Eigenvalues : det ( A − λ I ) = 0 \det(A - \lambda I) = 0 det ( A − λ I ) = 0 · ∑ λ i = tr ( A ) \sum\lambda_i = \text{tr}(A) ∑ λ i = tr ( A ) · ∏ λ i = det A \prod\lambda_i = \det A ∏ λ i = det A · eigenvalues of A k A^k A k : λ k \lambda^k λ k ; of A − 1 A^{-1} A − 1 : 1 / λ 1/\lambda 1/ λ ; of A + c I A + cI A + c I : λ + c \lambda + c λ + c · triangular: diagonal entries · symmetric: real eigenvalues, orthogonal eigenvectors.
Diagonalisable iff n n n independent eigenvectors (sufficient: n n n distinct eigenvalues). A = P D P − 1 A = PDP^{-1} A = P D P − 1 .
Special matrices: orthogonal Q T Q = I Q^TQ = I Q T Q = I (∣ λ ∣ = 1 |\lambda| = 1 ∣ λ ∣ = 1 , det = ± 1 \det = \pm1 det = ± 1 ) · idempotent P 2 = P P^2 = P P 2 = P (λ ∈ { 0 , 1 } \lambda\in\{0, 1\} λ ∈ { 0 , 1 } , rank = trace) · nilpotent (λ = 0 \lambda = 0 λ = 0 ) · projection onto the column space of A A A : P = A ( A T A ) − 1 A T P = A(A^TA)^{-1}A^T P = A ( A T A ) − 1 A T ; onto a \mathbf a a : a a T a T a \tfrac{\mathbf a\mathbf a^T}{\mathbf a^T\mathbf a} a T a a a T .
Quadratic form x T A x \mathbf x^TA\mathbf x x T A x : positive definite iff all eigenvalues > 0 > 0 > 0 iff all leading principal minors > 0 > 0 > 0 .
LU : A = L U A = LU A = LU (Gaussian elimination). SVD : A = U Σ V T A = U\Sigma V^T A = U Σ V T , singular values σ i = λ i ( A T A ) \sigma_i = \sqrt{\lambda_i(A^TA)} σ i = λ i ( A T A ) , rank = number of nonzero σ i \sigma_i σ i , best rank-k k k approximation keeps the top k k k .
Full pages: Linear Algebra .
Calculus and optimisation
Standard limits: lim x → 0 sin x x = 1 \lim_{x\to0}\tfrac{\sin x}{x} = 1 lim x → 0 x s i n x = 1 , lim e x − 1 x = 1 \lim\tfrac{e^x - 1}{x} = 1 lim x e x − 1 = 1 , lim ln ( 1 + x ) x = 1 \lim\tfrac{\ln(1+x)}{x} = 1 lim x l n ( 1 + x ) = 1 , lim x → ∞ ( 1 + 1 x ) x = e \lim_{x\to\infty}(1 + \tfrac1x)^x = e lim x → ∞ ( 1 + x 1 ) x = e . L'Hôpital for 0 0 \tfrac00 0 0 and ∞ ∞ \tfrac\infty\infty ∞ ∞ .
Differentiable ⇒ continuous (not conversely: ∣ x ∣ |x| ∣ x ∣ at 0).
Mean value theorem: f ′ ( c ) = f ( b ) − f ( a ) b − a f'(c) = \tfrac{f(b) - f(a)}{b - a} f ′ ( c ) = b − a f ( b ) − f ( a ) for some c ∈ ( a , b ) c\in(a, b) c ∈ ( a , b ) .
Taylor : f ( x ) = ∑ k f ( k ) ( a ) k ! ( x − a ) k f(x) = \sum_k\tfrac{f^{(k)}(a)}{k!}(x - a)^k f ( x ) = ∑ k k ! f ( k ) ( a ) ( x − a ) k . e x = ∑ x k k ! e^x = \sum\tfrac{x^k}{k!} e x = ∑ k ! x k · sin x = x − x 3 3 ! + … \sin x = x - \tfrac{x^3}{3!} + \dots sin x = x − 3 ! x 3 + … · cos x = 1 − x 2 2 ! + … \cos x = 1 - \tfrac{x^2}{2!} + \dots cos x = 1 − 2 ! x 2 + … · ln ( 1 + x ) = x − x 2 2 + x 3 3 − … \ln(1 + x) = x - \tfrac{x^2}2 + \tfrac{x^3}3 - \dots ln ( 1 + x ) = x − 2 x 2 + 3 x 3 − … · 1 1 − x = ∑ x k \tfrac1{1-x} = \sum x^k 1 − x 1 = ∑ x k .
Extrema : f ′ ( c ) = 0 f'(c) = 0 f ′ ( c ) = 0 ; f ′ ′ > 0 f'' > 0 f ′′ > 0 min, f ′ ′ < 0 f'' < 0 f ′′ < 0 max; if f ′ ′ = 0 f'' = 0 f ′′ = 0 use the first nonzero higher derivative (even order → extremum). On [ a , b ] [a, b] [ a , b ] also check the endpoints.
Gradient descent x k + 1 = x k − η f ′ ( x k ) x_{k+1} = x_k - \eta f'(x_k) x k + 1 = x k − η f ′ ( x k ) · Newton x k + 1 = x k − f ′ ( x k ) / f ′ ′ ( x k ) x_{k+1} = x_k - f'(x_k)/f''(x_k) x k + 1 = x k − f ′ ( x k ) / f ′′ ( x k ) . Convex: f ′ ′ ≥ 0 f'' \ge 0 f ′′ ≥ 0 , every local minimum is global.
Integration by parts ∫ u d v = u v − ∫ v d u \int u\,dv = uv - \int v\,du ∫ u d v = uv − ∫ v d u · ∫ 0 ∞ x n e − x d x = n ! \int_0^\infty x^ne^{-x}dx = n! ∫ 0 ∞ x n e − x d x = n ! · ∫ − ∞ ∞ e − x 2 d x = π \int_{-\infty}^\infty e^{-x^2}dx = \sqrt\pi ∫ − ∞ ∞ e − x 2 d x = π .
Full pages: Calculus .
Programming, data structures and algorithms
Algorithm / structure Time Notes Binary search O ( log n ) O(\log n) O ( log n ) sorted array Insertion sort O ( n 2 ) O(n^2) O ( n 2 ) , best O ( n ) O(n) O ( n ) stable, in place; adaptive Selection sort O ( n 2 ) O(n^2) O ( n 2 ) alwaysnot stable; at most n − 1 n - 1 n − 1 swaps Bubble sort O ( n 2 ) O(n^2) O ( n 2 ) , best O ( n ) O(n) O ( n ) with flagstable Merge sort O ( n log n ) O(n\log n) O ( n log n ) stable, O ( n ) O(n) O ( n ) extra space Quicksort avg O ( n log n ) O(n\log n) O ( n log n ) , worst O ( n 2 ) O(n^2) O ( n 2 ) in place, not stable Heap: build / insert / extract O ( n ) O(n) O ( n ) / O ( log n ) O(\log n) O ( log n ) / O ( log n ) O(\log n) O ( log n ) Hash table avg O ( 1 ) O(1) O ( 1 ) ; chaining expected length α = n / m \alpha = n/m α = n / m BST search O ( h ) O(h) O ( h ) : O ( log n ) O(\log n) O ( log n ) balanced, O ( n ) O(n) O ( n ) worstinorder = sorted BFS / DFS O ( V + E ) O(V + E) O ( V + E ) BFS gives shortest paths in unweighted graphs Dijkstra (binary heap) O ( ( V + E ) log V ) O((V + E)\log V) O (( V + E ) log V ) no negative edges Topological sort O ( V + E ) O(V + E) O ( V + E ) DAG only Kruskal / Prim O ( E log E ) O(E\log E) O ( E log E ) / O ( E log V ) O(E\log V) O ( E log V ) minimum spanning tree
Comparison sorting lower bound Ω ( n log n ) \Omega(n\log n) Ω ( n log n ) . Master theorem for T ( n ) = a T ( n / b ) + Θ ( n d ) T(n) = aT(n/b) + \Theta(n^d) T ( n ) = a T ( n / b ) + Θ ( n d ) : d > log b a d > \log_b a d > log b a → Θ ( n d ) \Theta(n^d) Θ ( n d ) ; = = = → Θ ( n d log n ) \Theta(n^d\log n) Θ ( n d log n ) ; < < < → Θ ( n log b a ) \Theta(n^{\log_b a}) Θ ( n l o g b a ) .
Binary tree: max nodes at height h h h : 2 h + 1 − 1 2^{h+1} - 1 2 h + 1 − 1 ; n 0 = n 2 + 1 n_0 = n_2 + 1 n 0 = n 2 + 1 ; complete tree height ⌊ log 2 n ⌋ \lfloor\log_2 n\rfloor ⌊ log 2 n ⌋ . Heap children of i i i (0-based): 2 i + 1 2i + 1 2 i + 1 , 2 i + 2 2i + 2 2 i + 2 .
Graphs: ∑ deg = 2 E \sum\deg = 2E ∑ deg = 2 E ; a tree has V − 1 V - 1 V − 1 edges; simple graph has at most ( V 2 ) \binom V2 ( 2 V ) edges.
Python: mutable default arguments persist; // floors toward − ∞ -\infty − ∞ ; slicing copies; is vs ==.
Full pages: Programming & DSA .
DBMS and warehousing
Keys: superkey ⊇ candidate key (minimal) ∋ primary key. Closure X + X^+ X + decides whether X X X is a key.
Armstrong's axioms: reflexivity, augmentation, transitivity (+ union, decomposition, pseudo-transitivity).
Normal forms : 1NF atomic · 2NF no partial dependency on a key · 3NF for every X → A X\to A X → A , X X X superkey or A A A prime · BCNF every X → A X\to A X → A has X X X superkey. Lossless join (binary) iff R 1 ∩ R 2 → R 1 R_1\cap R_2\to R_1 R 1 ∩ R 2 → R 1 or → R 2 \to R_2 → R 2 .
Relational algebra: σ , π , × , ⋈ , ∪ , − , ÷ , ρ \sigma, \pi, \times, \bowtie, \cup, -, \div, \rho σ , π , × , ⋈ , ∪ , − , ÷ , ρ ; ∣ R × S ∣ = ∣ R ∣ ∣ S ∣ |R\times S| = |R||S| ∣ R × S ∣ = ∣ R ∣∣ S ∣ ; natural join on no common attribute = cross product.
SQL: WHERE filters rows before grouping, HAVING filters groups; COUNT(*) counts NULLs, COUNT(col) does not; comparisons with NULL are unknown.
B+ tree of order p p p : nodes hold ⌈ p / 2 ⌉ \lceil p/2\rceil ⌈ p /2 ⌉ to p p p pointers; all data at leaves. Index levels ≈ ⌈ log fanout ( records ) ⌉ \approx\lceil\log_{\text{fanout}}(\text{records})\rceil ≈ ⌈ log fanout ( records )⌉ .
Normalisation of data: min–max x − min max − min \tfrac{x - \min}{\max - \min} m a x − m i n x − m i n , z-score x − μ σ \tfrac{x - \mu}{\sigma} σ x − μ . Warehousing: star schema (fact + denormalised dimensions), snowflake (normalised dimensions); OLAP roll-up, drill-down, slice, dice, pivot; a cube with n n n dimensions has 2 n 2^n 2 n cuboids (without hierarchies).
Full pages: DBMS .
Machine learning
Linear regression : β ^ = ( X T X ) − 1 X T y \hat{\boldsymbol\beta} = (X^TX)^{-1}X^T\mathbf y β ^ = ( X T X ) − 1 X T y ; simple: β ^ 1 = Cov ( x , y ) Var ( x ) \hat\beta_1 = \tfrac{\text{Cov}(x, y)}{\text{Var}(x)} β ^ 1 = Var ( x ) Cov ( x , y ) , β ^ 0 = y ˉ − β ^ 1 x ˉ \hat\beta_0 = \bar y - \hat\beta_1\bar x β ^ 0 = y ˉ − β ^ 1 x ˉ ; R 2 = 1 − S S r e s S S t o t R^2 = 1 - \tfrac{SS_{res}}{SS_{tot}} R 2 = 1 − S S t o t S S r es .
Ridge : ( X T X + λ I ) − 1 X T y (X^TX + \lambda I)^{-1}X^T\mathbf y ( X T X + λ I ) − 1 X T y (shrinks; never exactly zero) · Lasso (ℓ 1 \ell_1 ℓ 1 ) gives sparsity.
Logistic : σ ( z ) = 1 1 + e − z \sigma(z) = \tfrac1{1 + e^{-z}} σ ( z ) = 1 + e − z 1 , σ ′ = σ ( 1 − σ ) \sigma' = \sigma(1 - \sigma) σ ′ = σ ( 1 − σ ) ; log-odds linear; cross-entropy loss; gradient X T ( σ ( X w ) − y ) X^T(\sigma(X\mathbf w) - \mathbf y) X T ( σ ( X w ) − y ) .
k-NN : no training; small k k k → high variance, large k k k → high bias. Naive Bayes : P ( c ∣ x ) ∝ P ( c ) ∏ j P ( x j ∣ c ) P(c\mid\mathbf x)\propto P(c)\prod_j P(x_j\mid c) P ( c ∣ x ) ∝ P ( c ) ∏ j P ( x j ∣ c ) ; Laplace smoothing n j c + 1 n c + V \tfrac{n_{jc} + 1}{n_c + V} n c + V n j c + 1 .
LDA : shared covariance → linear boundary; Fisher direction w ∝ S W − 1 ( μ 1 − μ 2 ) \mathbf w\propto S_W^{-1}(\boldsymbol\mu_1 - \boldsymbol\mu_2) w ∝ S W − 1 ( μ 1 − μ 2 ) .
SVM : maximise margin 2 ∥ w ∥ \tfrac2{\|\mathbf w\|} ∥ w ∥ 2 s.t. y i ( w T x i + b ) ≥ 1 y_i(\mathbf w^T\mathbf x_i + b)\ge1 y i ( w T x i + b ) ≥ 1 ; hinge loss max ( 0 , 1 − y f ( x ) ) \max(0, 1 - yf(x)) max ( 0 , 1 − y f ( x )) ; kernels K ( x , z ) = ϕ ( x ) T ϕ ( z ) K(\mathbf x, \mathbf z) = \phi(\mathbf x)^T\phi(\mathbf z) K ( x , z ) = ϕ ( x ) T ϕ ( z ) .
Trees : entropy H = − ∑ p i log 2 p i H = -\sum p_i\log_2 p_i H = − ∑ p i log 2 p i , Gini 1 − ∑ p i 2 1 - \sum p_i^2 1 − ∑ p i 2 , information gain = H ( parent ) − ∑ n k n H ( k ) = H(\text{parent}) - \sum\tfrac{n_k}{n}H(k) = H ( parent ) − ∑ n n k H ( k ) .
Bias–variance : E [ ( y − f ^ ) 2 ] = bias 2 + variance + σ 2 E[(y - \hat f)^2] = \text{bias}^2 + \text{variance} + \sigma^2 E [( y − f ^ ) 2 ] = bias 2 + variance + σ 2 . k k k -fold CV trains k k k models; LOOCV trains n n n .
Neural networks : MLP with one hidden layer is a universal approximator; parameters of a dense layer = n i n n o u t + n o u t = n_{in}n_{out} + n_{out} = n in n o u t + n o u t ; ReLU max ( 0 , z ) \max(0, z) max ( 0 , z ) ; backprop = chain rule.
k-means : minimises ∑ ∥ x − μ c ( x ) ∥ 2 \sum\|\mathbf x - \boldsymbol\mu_{c(\mathbf x)}\|^2 ∑ ∥ x − μ c ( x ) ∥ 2 , converges to a local optimum. Linkage: single (min), complete (max), average.
PCA : eigenvectors of the covariance matrix; variance explained by component k k k = λ k / ∑ λ i \lambda_k/\sum\lambda_i λ k / ∑ λ i .
Metrics: precision T P T P + F P \tfrac{TP}{TP + FP} T P + F P T P , recall T P T P + F N \tfrac{TP}{TP + FN} T P + F N T P , F 1 = 2 P R P + R F_1 = \tfrac{2PR}{P + R} F 1 = P + R 2 P R , accuracy T P + T N all \tfrac{TP + TN}{\text{all}} all T P + T N .
Full pages: Machine Learning .
Artificial intelligence
Search Complete Optimal Time Space BFS yes (b b b finite) yes (unit costs) O ( b d ) O(b^d) O ( b d ) O ( b d ) O(b^d) O ( b d ) Uniform-cost yes (ϵ > 0 \epsilon > 0 ϵ > 0 ) yes O ( b 1 + ⌊ C ∗ / ϵ ⌋ ) O(b^{1 + \lfloor C^*/\epsilon\rfloor}) O ( b 1 + ⌊ C ∗ / ϵ ⌋ ) same DFS no (infinite / cycles) no O ( b m ) O(b^m) O ( b m ) O ( b m ) O(bm) O ( bm ) Depth-limited no no O ( b ℓ ) O(b^\ell) O ( b ℓ ) O ( b ℓ ) O(b\ell) O ( b ℓ ) Iterative deepening yes yes (unit costs) O ( b d ) O(b^d) O ( b d ) O ( b d ) O(bd) O ( b d ) Greedy best-first no (tree search) no O ( b m ) O(b^m) O ( b m ) O ( b m ) O(b^m) O ( b m ) A* yes yes if h h h admissible (tree) / consistent (graph) exponential exponential
f = g + h f = g + h f = g + h . Admissible: h ( n ) ≤ h ∗ ( n ) h(n)\le h^*(n) h ( n ) ≤ h ∗ ( n ) . Consistent: h ( n ) ≤ c ( n , n ′ ) + h ( n ′ ) h(n)\le c(n, n') + h(n') h ( n ) ≤ c ( n , n ′ ) + h ( n ′ ) (consistent ⇒ admissible). max ( h 1 , h 2 ) \max(h_1, h_2) max ( h 1 , h 2 ) of admissible heuristics is admissible and dominates.
Minimax O ( b m ) O(b^m) O ( b m ) ; alpha–beta with perfect ordering O ( b m / 2 ) O(b^{m/2}) O ( b m /2 ) ; prune when α ≥ β \alpha\ge\beta α ≥ β .
Logic : p → q ≡ ¬ p ∨ q ≡ ¬ q → ¬ p p\to q\equiv\neg p\vee q\equiv\neg q\to\neg p p → q ≡ ¬ p ∨ q ≡ ¬ q → ¬ p · KB ⊨ α \models\alpha ⊨ α iff KB ∧ ¬ α \wedge\neg\alpha ∧ ¬ α unsatisfiable · resolution · Horn clauses: forward/backward chaining · ¬ ∀ x P ≡ ∃ x ¬ P \neg\forall x\,P\equiv\exists x\,\neg P ¬∀ x P ≡ ∃ x ¬ P · "All P P P are Q Q Q ": ∀ x ( P → Q ) \forall x(P\to Q) ∀ x ( P → Q ) ; "Some P P P are Q Q Q ": ∃ x ( P ∧ Q ) \exists x(P\wedge Q) ∃ x ( P ∧ Q ) .
Bayesian networks : P ( x 1 . . x n ) = ∏ P ( x i ∣ parents ) P(x_1..x_n) = \prod P(x_i\mid\text{parents}) P ( x 1 .. x n ) = ∏ P ( x i ∣ parents ) ; Boolean node with k k k parents: 2 k 2^k 2 k numbers; chain/fork blocked by observing the middle; collider blocked unless it or a descendant is observed; Markov blanket = parents + children + co-parents.
Inference : P ( X ∣ e ) = α ∑ y P ( X , e , y ) P(X\mid\mathbf e) = \alpha\sum_{\mathbf y}P(X, \mathbf e, \mathbf y) P ( X ∣ e ) = α ∑ y P ( X , e , y ) · VE: multiply factors with H H H , sum out H H H · polytrees linear, general NP-hard · rejection sampling keeps fraction P ( e ) P(\mathbf e) P ( e ) · likelihood weighting w = ∏ P ( e j ∣ parents ) w = \prod P(e_j\mid\text{parents}) w = ∏ P ( e j ∣ parents ) · Gibbs: sample from P ( x i ∣ Markov blanket ) P(x_i\mid\text{Markov blanket}) P ( x i ∣ Markov blanket ) .
Full pages: AI .
General aptitude
Successive % changes a + b + a b 100 a + b + \tfrac{ab}{100} a + b + 100 ab · km/h × 5/18 = m/s · together a b a + b \tfrac{ab}{a + b} a + b ab · average speed 2 u v u + v \tfrac{2uv}{u + v} u + v 2 uv · CI − SI (2 yrs) = P ( R / 100 ) 2 = P(R/100)^2 = P ( R /100 ) 2 · clock angle ∣ 30 H − 5.5 M ∣ |30H - 5.5M| ∣30 H − 5.5 M ∣ · mirror clock 11 : 60 − t 11{:}60 - t 11 : 60 − t · painted cube 8 , 12 ( n − 2 ) , 6 ( n − 2 ) 2 , ( n − 2 ) 3 8, 12(n-2), 6(n-2)^2, (n-2)^3 8 , 12 ( n − 2 ) , 6 ( n − 2 ) 2 , ( n − 2 ) 3 · squares in an n × n n\times n n × n grid ∑ k 2 \sum k^2 ∑ k 2 .
Full pages: General Aptitude .