Divide-and-conquer is a method for designing efficient algorithms. It works by recursively splitting a problem into smaller instances, solving them, and then combining their results. When a subproblem becomes small enough (the base case), it’s solved directly.
The three steps are:
A recurrence is an equation (or inequality) that defines a function in terms of itself. It has:
If at least one function satisfies it, it’s well-defined; otherwise, ill-defined.
A recurrence is algorithmic if, for every sufficiently large threshold , the following two properties hold:
For $(n < n_0):T(n) = Θ(1)$
The running time for small inputs is constant (solved directly without recursion).
For $(n ≥ n_0)$ Every path of recursion terminates in a base case after a finite number of recursive calls.
For small inputs $(n < n_0)$, the algorithm must always return a result in finite time.
If the recursion does not terminate for $(n ≥ n_0)$, the algorithm is incorrect, as it would run infinitely.