Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


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

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

2 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); }

3 B.1 Solving Recurrences Using Induction

4

5 Example B.2

6 B.1 Solving Recurrences Using Induction

7

8 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.

9 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

10 B.2 Solving Recurrences Using The Characteristic Equation

11

12

13

14

15

16

17

18

19

20

21 Example B.10 We solve the recurrence

22 B.2 Solving Recurrences Using The Characteristic Equation

23 Example B.11

24 B.2 Solving Recurrences Using The Characteristic Equation

25 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.

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

27 B.2 Solving Recurrences Using The Characteristic Equation

28

29 Example B.15

30 B.2 Solving Recurrences Using The Characteristic Equation

31 Example B.16

32 B.2 Solving Recurrences Using The Characteristic Equation

33 Example B.17

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

35 B.2.3 Change of Variables (Domain Transformations)

36 Example B.19

37 B.2.3 Change of Variables (Domain Transformations)

38 Example B.20

39 B.2.3 Change of Variables (Domain Transformations)

40 B.3 Solving Recurrences By Substitution

41

42

43


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

Similar presentations


Ads by Google