Algorithm Comparisons
Side-by-side breakdowns of algorithms that are commonly confused or compared on CS exams. Each entry covers core mechanics, complexity tradeoffs, and when to use which.
Machine Learning
Classifiers, regressors, and evaluation metrics — when to use each and what tradeoffs to expect.
KNN Classification vs. Naive Bayes
A deep-dive comparison of K-Nearest Neighbors vs. Naive Bayes. Understand lazy vs. eager learning, complexity tradeoffs, and exactly when to use each algorithm for exams.
Decision Tree vs. Naive Bayes Classifier
Decision Trees split data using impurity measures to build explicit rules. Naive Bayes applies Bayes' Theorem assuming feature independence. Learn how they differ in assumptions, interpretability, data type fit, and exam traps.
Decision Tree vs. Random Forest
A single Decision Tree is fast and interpretable but overfits easily. A Random Forest combines hundreds of trees to reduce variance at the cost of interpretability. Learn the tradeoffs, complexity, and exam pitfalls.
KNN Classification vs. KNN Regression
KNN Classification and KNN Regression share the same distance-based neighbor lookup, but differ in how they produce a final answer. Learn the exact difference, metrics, and when to use each.
KNN Regression vs. Linear Regression
KNN Regression memorizes training data and predicts locally. Linear Regression fits a global straight-line equation to the data. Learn the parametric vs. non-parametric distinction, complexity tradeoffs, and exam pitfalls.
KNN Classification vs. K-Means Clustering
KNN and K-Means both use distances and the letter K, but they solve completely different problems. Learn the supervised vs. unsupervised distinction, complexity tradeoffs, and exam pitfalls.
Simple Linear Regression vs. Multiple Linear Regression
Simple Linear Regression fits a line through one feature. Multiple Linear Regression fits a hyperplane through many. Learn the model equations, assumptions, $R^2$ interpretation, multicollinearity, and exam traps.
Precision vs. Recall (and the F1 Tradeoff)
Precision and Recall measure different things from the confusion matrix and pull in opposite directions. Learn the formulas, the tradeoff, F1-score, and exactly when to prioritize each for CS exams.
Random Forest vs. K-Nearest Neighbors (KNN)
Random Forest trains an ensemble of decision trees at training time. KNN memorizes data and does all computation at prediction time. Compare accuracy, speed, memory, feature handling, and exam pitfalls.
Graph Search
Uninformed and informed search strategies — optimality, completeness, and complexity tradeoffs.
A* Search vs. Greedy Best-First Search
A* uses both path cost and heuristic to guarantee the optimal solution. Greedy Best-First only follows the heuristic and finds a solution fast — but not necessarily the best one. Learn the f(n) vs h(n) distinction, admissibility, and exam traps.
A* Search vs. Uniform Cost Search (UCS)
UCS is optimal but explores blindly in all directions by cost. A* is also optimal but uses a heuristic to focus the search toward the goal. Learn why A* dominates UCS, when UCS is preferred, and the admissibility condition that links them.
Breadth-First Search (BFS) vs. Depth-First Search (DFS)
BFS explores layer by layer using a queue. DFS dives deep using a stack. They have opposite memory footprints, different completeness guarantees, and completely different use cases. Master the tradeoffs here.
Uniform Cost Search (UCS) vs. Breadth-First Search (BFS)
BFS finds the shortest path by number of edges. UCS finds the shortest path by total edge cost. When all edges cost the same, they are identical. Learn exactly when they differ, the g(n) priority distinction, and exam traps.
Greedy Best-First Search vs. Uniform Cost Search (UCS)
Greedy search rushes toward the goal using only a heuristic estimate — it's fast but can find a suboptimal path or get stuck. UCS ignores the goal entirely and expands by actual cost — it's slower but always finds the cheapest solution. Learn when each is appropriate and why neither is A*.
Game Trees & Adversarial Search
Algorithms for two-player zero-sum games, with and without pruning.
Optimization & Evolutionary
Nature-inspired and constraint-based optimization approaches compared side by side.
Support vs. Confidence vs. Lift in Apriori
Support, Confidence, and Lift are the three lenses Apriori uses to evaluate association rules. Support filters rare combinations. Confidence measures directional strength. Lift tells you whether the relationship is real or just a coincidence caused by popularity. Learn exactly what each measures and how they work together.
Genetic Algorithm (General) vs. Genetic Algorithm for the Knapsack Problem
The Genetic Algorithm is a general-purpose optimization framework inspired by natural selection. Applying it to the 0/1 Knapsack Problem requires specific choices: binary chromosomes, a penalty-based or repair-based fitness function, and operators that respect the weight constraint. Learn what changes and what stays the same.
Missing a comparison? Request one