Empirical Analysis

Algorithm Comparison

Side-by-side performance analysis across problem domains

Algorithm Comparison

Nodes / Steps Explored (Log Scale)

Backtracking
Forward Checking
Min-Conflicts
NBacktracking (nodes)Forward Checking (nodes)Min-Conflicts (avg steps)
4853
6152388
887621012
109753907
123,0661,10014
1417,7565,20010
165421899
1810,0943,80011
2055,59019,80015
Key Insight

Forward Checking explores ~58% fewer nodes than Backtracking but runs ~3x slower due to domain copying overhead. Min-Conflicts achieves O(n) average-case — orders of magnitude faster.

Pruning Efficiency by Depth

Nodes Explored (Log Scale) — With & Without Pruning

No Pruning
Alpha-Beta
Pruning %
DepthNodes (no pruning)Nodes (with α-β)Pruning %Time (ms)
2492744.9%<1
42,40144081.7%2
6117,6495,21795.6%45
85,764,80145,81099.2%380
Key Insight

Pruning effectiveness increases with depth: from 44.9% at depth 2 to 99.2% at depth 8. The deeper you search, the more you save.

Guess Distribution

Codes Solved per Guess Count (of 360 total)

Codes Solved
Cumulative %
GuessesCodes SolvedCumulative %
110.3%
282.5%
36219.7%
416866.4%
510896.4%
613100%
Key Insight

Average: 4.15 guesses. The first guess eliminates ~82% of candidates. By guess 3, 19.7% of codes are already cracked.

The Pruning Cost-to-Benefit Ratio

The central finding across all four problems: an algorithm's real-world efficiency depends not on theoretical complexity alone, but on the ratio between the cost of its optimization strategy and the savings that strategy produces.

Alpha-Beta Pruning

Connect 4
Optimization costNear zero
SavingsExponential (94-99%)
MechanismTwo integer comparisons/node

Verdict: Always worth it — the optimization is essentially free

Forward Checking

N-Queens
Optimization costHigh
SavingsLinear (58% nodes)
MechanismO(n²) domain copying/step

Verdict: Not always worth it — overhead exceeds savings at small N

Constraint Elimination

Mastermind
Optimization costModerate
SavingsHigh (82% / round)
MechanismCandidate filtering each guess

Verdict: Worth it — finite search space makes per-step cost acceptable

Related Research

This cross-problem analysis sits alongside a separate research paper: “From Game-Theoretic Poker to the Collapse of Trust: Modelling Strategic Behaviour in Multi-Agent Systems” (Polygence, 2025). Where this project studies algorithms playing against known rules, the paper studies what happens when the “rules” are other agents — adaptive, strategic, potentially deceptive. The shared thread: how rational agents behave under constraint, and when their optimizations break down.

================================================================ -->

Complexity Summary

AlgorithmProblemTimeSpaceOptimal?Key Strength
BacktrackingN-Queens O(n!)O(n) Yes (finds all)Simplicity
Forward CheckingN-Queens O(n!)O(n²) YesEarly pruning
Min-ConflictsN-Queens O(n) avgO(n) ProbabilisticSpeed
MinimaxConnect 4 O(bd)O(bd) YesOptimal play
Alpha-BetaConnect 4 O(bd/2)O(bd) YesPruned optimal
Constraint ElimMastermind O(k·n)O(n) Near-optimalInformation gain

Explore the algorithms interactively