# Appendix B Solving Recurrence Equations ： With Applications to Analysis of Recursive Algorithms.

## Presentation on theme: "Appendix B Solving Recurrence Equations ： With Applications to Analysis of Recursive Algorithms."— Presentation transcript:

Appendix B Solving Recurrence Equations ： With Applications to Analysis of Recursive Algorithms

B.1 Solving Recurrences Using Induction Algorithm B.1 Factorial Problem: Determine n!=n(n-1)(n-2)…(3)(2)(1) when n>=1. 0!=1 Input: a nonnegative integer n. Output: n!. int fact(int n){ if(n==0) return 1; else return n*fact(n-1); }

B.1 Solving Recurrences Using Induction

Example B.2

B.1 Solving Recurrences Using Induction

B.2 Solving Recurrences Using The Characteristic Equation B.2.1 Homogeneous Linear Recurrences Definition A recurrence of the form a 0 t n + a 1 t n-1 + ··· + a k t n-k = 0 where k and the a i terms are constants, is called a homogeneous linear recurrence equation with constant coefficients.

B.2 Solving Recurrences Using The Characteristic Equation Example B.4 The following are homogeneous linear recurrence equations with constant coefficients: 7t n - 3t n-1 = 0 6t n - 5t n-1 + 8t n-2 = 0 8t n - 4t n-3 = 0

B.2 Solving Recurrences Using The Characteristic Equation

Example B.10 We solve the recurrence

B.2 Solving Recurrences Using The Characteristic Equation

Example B.11

B.2 Solving Recurrences Using The Characteristic Equation

B.2.2 Nonhomogeneous Linear Recurrences Definition: A recurrence of the form a 0 t n + a 1 t n-1 + ··· + a k t n-k = f(n) where k and the a i terms are constants and f(n) is a function other than the zero function, is called a nonhomogeneous linear recurrence equation with constant coefficients.

B.2 Solving Recurrences Using The Characteristic Equation Example B.14

B.2 Solving Recurrences Using The Characteristic Equation

Example B.15

B.2 Solving Recurrences Using The Characteristic Equation

Example B.16

B.2 Solving Recurrences Using The Characteristic Equation

Example B.17

B.2.3 Change of Variables (Domain Transformations) Example B.18

B.2.3 Change of Variables (Domain Transformations)

Example B.19

B.2.3 Change of Variables (Domain Transformations)

Example B.20

B.2.3 Change of Variables (Domain Transformations)

B.3 Solving Recurrences By Substitution

Download ppt "Appendix B Solving Recurrence Equations ： With Applications to Analysis of Recursive Algorithms."

Similar presentations