Idea: divide the problem into several (equal) parts (recursively) conquer/solve each of the sub problems combine sub problem solutions
Substitution method
Guess the solution, then find the constants using induction
Prove solution validity with induction
Example
Assume:
Prove:
Inductive assumption:
Base case: not, but yes
Recursive tree
Draw recursive tree, then sum complexity level-wise and altogether
Prove solution validity with induction
Example
Assume: ,
Draw tree:
Proof by induction:
Master theorem
- Get , and from:
- Calculate
- Use it to determine the asymptotic bounds of :
Less / more leafs in recursion tree peak dominates (1. rule) / bottom dominates (3. rule)
Example
, ,
,
Akra-Bazzi theorem
- Get all , and which must be polinomially limited
- Calculate in
- Use it to determine the asymptotic bounds of :
Example
, , , ,
Solving linear recurrances with annihilators
Linear reccurance: is a linear combination of nearby values , , …
Operator: higher order function, taking other functions as arguments (eg. integral, differential, … )
| Operator | Definition |
|---|---|
| Addition | |
| Substraction | |
| Multiplication | |
| Shift | |
| -fold shift | |
| Composition | |
| Distribution | |
| Annihilator: nontrivial operator transforming function to 0, every polinomial/exponential function has a unique minimal annihilator |
| Operator | Function annihilated |
|---|---|
- annihilates annihilates
- annihilates annihilates for any constant
- annihilates and annihilates
- annihilates and annihilates annihilates
Annihilating recurrances:
- Write recurrance in operator form
- Extract an annihilator for the recurrance
- Factor the annihilator (if necessary and possible)
- Extract the generic solution from the annihilator
- Solve for coefficients using the base cases (if known)
Example
… generic solution
