3.7.2 · D5Algorithm Paradigms
Question bank — Divide and conquer — template, correctness, recurrence
Every "true/false" answer below carries a reason — a bare yes/no is worthless here.
True or false — justify
More subproblems ( larger) always makes a divide-and-conquer algorithm faster.
False. sits in the exponent , so raising raises the leaf cost . Karatsuba wins precisely by dropping from 4 to 3, not by adding subproblems.
If the two halves of the input are each solved correctly, the whole answer is automatically correct.
False. Correct parts only give a correct whole if the combine step is itself correct — that is a separate proof obligation (e.g.
merge in Mergesort needs its own loop-invariant argument).The recursion tree method and the Master Theorem can solve different sets of recurrences.
True. The recursion tree is more general; the Master Theorem is a shortcut that only applies when is polynomially above/below , so it fails on gaps like over .
A divide-and-conquer proof of correctness is really a proof by Mathematical Induction.
True. The base case is the induction base, the recursive calls invoke the inductive hypothesis on smaller sizes, and combine-correctness is the inductive step — the recursion tree is the induction tree.
In , the term counts the cost of the recursive calls.
False. is the non-recursive work only — divide plus combine. The recursive work is captured by the term, kept separate so we can unroll it.
Master Theorem Case 3 needs only that grows faster than .
False. It also needs the regularity condition for some ; without it a fast-growing but wildly oscillating can escape Case 3.
Binary search and mergesort both fall into Master Theorem Case 2.
True. Binary Search has with , and Mergesort has with — in both, matches the leaf cost, giving the extra factor.
Making the base-case threshold larger changes the asymptotic -class.
False. A constant threshold only changes constants and low-order terms; the Big-O class stays the same, though it can help real-world constants.
Divide and conquer requires the subproblems to be independent (non-overlapping).
True. If subproblems overlap and get re-solved, you are in Dynamic Programming territory instead; pure D&C assumes the pieces don't share sub-work.
Spot the error
"My split turns an array of length 1 into [] and [the whole array], and recursion will terminate on its own."
Error: no progress. One branch still has size 1, so it never shrinks — infinite recursion. Every recursive call must have strictly smaller size, which forces an explicit base case.
" has and , so by Case 3 the answer is ."
Error: is only a logarithmic factor above , not polynomially above — so Case 3 does not apply. The recursion tree gives .
"For (Karatsuba), since and , the cost is ."
Error: you cannot just multiply by . Here , so is below the leaf cost → Case 1 → .
"I proved combine is correct, so my algorithm is correct."
Error: incomplete proof. You still owe progress (every call strictly smaller) and base correctness (smallest cases right). Missing either breaks both proof and code.
" has one subproblem, so there's no tree and the total is ."
Error: with the tree is a single chain of height , each node doing → total , not .
"Strassen does 8 multiplications of half-size matrices, giving just like schoolbook."
Error: Strassen does only 7 multiplies (), so and — strictly below .
Why questions
Why do we bundle divide-cost and combine-cost into a single ?
Because for the recurrence we only care about the total non-recursive work per call; separating them adds no information but clutters the analysis.
Why does the number of leaves equal and not just ?
There are levels, and each level multiplies the node count by , giving leaves — the branching factor dictates the exponent.
Why is the base case not optional even when subproblems shrink?
Because "shrinking" is only guaranteed if you prove strict progress; a bad split can stall at a fixed size, and without a return-without-recursing rule the stack overflows.
Why does reducing (fewer subproblems) matter more than reducing in Karatsuba?
lives in the exponent , which controls the polynomial degree of the runtime; shaving only changes lower-order terms once you're leaf-dominated.
Why can two algorithms with the same and have different asymptotic runtimes?
Because the answer also depends on relative to — a cheaper or costlier combine can push you into a different Master Theorem case.
Why is Mathematical Induction the natural correctness tool for recursion rather than a direct loop invariant?
Recursion re-invokes the same procedure on smaller inputs, which is exactly the shape of an inductive hypothesis "assume it works for size " — the tool matches the structure.
Edge cases
What is when the input has size or ?
It is by definition — this is the base case, answered directly without recursion, and it anchors the whole induction.
What happens to the recurrence when ?
The "tree" degenerates to a chain of height ; there is no leaf explosion, so cost is driven purely by the sum of down that chain (e.g. Binary Search → ).
What does equal when , and what does it mean?
It is negative (or, when , zero); it signals the recursion shrinks work faster than it branches, so almost always dominates and you fall into Case 3.
What if the split is uneven, e.g. sizes and (as in a bad Quicksort pivot)?
The clean Master Theorem no longer applies; you use the recursion-tree method or Akra–Bazzi, and unbalanced splits can degrade Quicksort toward in the worst case.
What is the runtime when the combine step alone already costs while ?
is polynomially above the leaf cost → Case 3 → ; the root's combine work dominates the entire tree.
Recall Quick self-test
The single most common trap on this page ::: Confusing (non-recursive work) with the recursive cost, or assuming "more/smaller subproblems = faster" — remember lives in the exponent.