Solved Numerical Examples
Follow exact mathematical breakdowns of popular algorithms. Perfect for exam preparation, these step-by-step guides show you exactly how to trace formulas and data structures by hand.
Machine Learning
Step-by-step solved problems for classifiers and regressors. See exact entropy calculations, matrix inversions, and distance formulas.
Naive Bayes Classifier
Calculates prior and conditional probabilities step-by-step to predict a class label using Bayes' Theorem.
Confusion Matrix & Evaluation Metrics
Derives Accuracy, Precision, Recall, and F1 Score from a 2×2 matrix of TP, TN, FP, and FN counts.
Decision Tree (ID3)
Calculates Entropy and Information Gain for each feature to determine the optimal recursive splits.
K-Means Clustering
Iteratively assigns points to nearest centroids and recomputes centroid means until cluster assignments converge.
K-Nearest Neighbors (Classification)
Computes Euclidean distances from a query point to all training points, then votes among K nearest neighbors.
K-Nearest Neighbors Regression
Computes Euclidean distances from a query point to all training points, then averages the K nearest target values.
Linear Regression
Derives the slope and intercept using the least squares formula, then predicts a continuous target value.
Multiple Linear Regression
Solves the Normal Equation β = (XᵀX)⁻¹Xᵀy using matrix operations to find all feature coefficients simultaneously.
Random Forest Classifier
Runs ID3 on three bootstrap samples with restricted feature subsets, then aggregates predictions by majority vote.
Graph Search
Trace trees and graphs using uninformed and informed search strategies, complete with node exploration and heuristic tracking.
A* Search Algorithm
Expands nodes by f(n)=g(n)+h(n), tracking an open list and closed list to find the guaranteed optimal path.
Breadth-First Search (BFS)
Explores a graph level by level using a FIFO queue, guaranteeing the shallowest path to the goal node.
Depth-First Search (DFS)
Explores a graph by committing fully to each path using a LIFO stack, backtracking only on dead ends.
Uniform Cost Search (Dijkstra's Algorithm)
Expands nodes in strict order of cumulative path cost using a priority queue, guaranteeing the cheapest route to the goal.
Greedy Best-First Search
Expands the node with the lowest heuristic h(n) at every step, ignoring cumulative path cost entirely.
Game Trees & Adversarial Search
Minimax and Alpha-Beta pruning solved examples. See exactly which nodes are evaluated and which branches are pruned.
Alpha-Beta Pruning
Traverses a Minimax game tree left-to-right, maintaining alpha and beta bounds to prune provably irrelevant subtrees.
Minimax Algorithm
Propagates terminal leaf values up a game tree — MAX nodes select the highest child, MIN nodes select the lowest.
Optimization & Evolutionary
Iterative mathematical calculations for Genetic Algorithms, Simulated Annealing, and local search methods.
Apriori Algorithm
Generates frequent itemsets pass-by-pass using minimum support pruning, then derives association rules above minimum confidence.
Genetic Algorithm (One-Max)
Runs selection, single-point crossover, and mutation across generations to evolve binary strings toward all 1s.
Genetic Algorithm (Knapsack)
Evolves binary chromosomes encoding item selections, applying fitness penalties when weight capacity is exceeded.
Stuck on a specific problem? Request an example