Strategy Beats Blind Search
What This Concept Is
Algorithm strategy is the high-level pattern you use to search for a solution. Common families include brute force, backtracking, heuristics, divide and conquer, and dynamic programming. They differ in how much of the search space they inspect and how much work they reuse.
Why It Matters Here
Two solutions can target the same problem but live in different universes of practicality. Strategy is where that difference often begins. If you can recognize the shape of a problem, you can often choose a strategy that avoids wasted work instead of simply coding faster.
Concrete Example
Consider a packing problem:
- brute force checks every candidate combination
- backtracking gives up early when partial choices already fail
- a greedy heuristic picks what looks best now and keeps moving
- dynamic programming reuses repeated subproblems
Or consider sorting:
- naive repeated comparisons can lead to
O(n^2)work - divide and conquer splits the list, solves smaller parts, then merges them back
The strategy changes the cost before the syntax changes.
Common Confusion / Misconception
Heuristics are not automatically sloppy, and brute force is not automatically wrong. Sometimes brute force is the only realistic exact method for small inputs. Sometimes a heuristic is the right business choice because "good enough soon" beats "perfect too late." The mistake is treating one family as universally best.
How To Use It
Ask these questions:
- Can I inspect all candidates, or is that too expensive?
- Can partial bad choices be rejected early?
- Does the problem split into similar smaller subproblems?
- Are the same subproblems being solved repeatedly?
- Is a near-optimal answer acceptable if it arrives much faster?
| Strategy | Best first signal |
|---|---|
| Brute force | Search space is small enough or exactness is mandatory |
| Backtracking | Partial choices can be ruled out early |
| Heuristic | Fast good-enough answers beat perfect expensive ones |
| Divide and conquer | The problem splits cleanly into similar smaller ones |
| Dynamic programming | Overlapping subproblems are causing repeated work |
Check Yourself
- What is the difference between backtracking and brute force?
- When is a heuristic the right choice even if it may miss the optimum?
- Why does memoization help some recursive problems so much?
Mini Drill or Application
Classify each problem with the strategy you would try first and explain why:
- solving a small puzzle with very few combinations
- finding a route through a huge space where perfect is not required
- sorting a large list
- optimizing a recursive solution that recalculates the same values many times
Your answer should name the signal that led to the strategy, not just the strategy name.