Methods of Recurrence Relation
Methods of Recurrence Relation
Relations
An Overview of Common Techniques
Introduction to Recurrence
Relations
• • A recurrence relation is an equation that
recursively defines a sequence.
• • It expresses each term as a function of its
preceding terms.
• • Commonly used in algorithms and computer
science.
• • Solving recurrence relations helps in
understanding algorithm complexity.
Substitution Method (Iteration
Method)
• • Expand the recurrence by expressing terms
in terms of previous ones.
• • Identify a pattern and derive a closed-form
solution.
• • Example: T(n) = 2T(n/2) + n
• - Expand: T(n) = 2(2T(n/4) + n/2) + n
• - Continue until base case is reached.
Recurrence Tree Method
• • Visualizes recurrence expansion as a tree.
• • Helps in estimating the work done at each
level.
• • Sum up the work at each level to get the
final complexity.
• • Useful for divide-and-conquer recurrences
like T(n) = 2T(n/2) + n.
Master Theorem
• • Provides a formula to solve recurrence
relations of the form:
• T(n) = aT(n/b) + f(n)
• • Compare f(n) with n^(log_b a) to determine
complexity.
• • Cases:
• - If f(n) = O(n^(log_b a - ε)), T(n) = O(n^(log_b
a)).
• - If f(n) = Θ(n^(log_b a)), T(n) = O(n^(log_b a)
log n).
Characteristic Equation Method
• • Used for linear recurrence relations with
constant coefficients.
• • Example: T(n) - 3T(n-1) + 2T(n-2) = 0
• - Assume solution of the form T(n) = r^n.
• - Form the characteristic equation: r^2 - 3r +
2 = 0.
• - Solve for r to get the general solution.
Conclusion
• • Recurrence relations are essential in
algorithm analysis.
• • Different methods are used based on
problem type.
• • Master theorem is quick but has limitations.
• • Characteristic equation works well for linear
recurrences.
• • Understanding these methods helps in
solving complex problems efficiently.