Presentation is loading. Please wait.

Presentation is loading. Please wait.

1Computer Sciences. 2 GROWTH OF FUNCTIONS 3.2 STANDARD NOTATIONS AND COMMON FUNCTIONS.

Similar presentations


Presentation on theme: "1Computer Sciences. 2 GROWTH OF FUNCTIONS 3.2 STANDARD NOTATIONS AND COMMON FUNCTIONS."— Presentation transcript:

1 1Computer Sciences

2 2 GROWTH OF FUNCTIONS 3.2 STANDARD NOTATIONS AND COMMON FUNCTIONS

3 Standard notations and common functions  Logarithms.  Exponential.  Factorials. Objective

4

5

6 Computer Sciences6 RECURRENCES TUTORIAL 3

7  Recurrences. Substitution method, Recursion-tree method, Master method. Objective

8 Exercise 1: Use the substitution method to show that T(n) = O(n 2 lg (n/2)) if : T (n) = 2 T (n/2) + n Solution : T(n) ≤ 2 T((n 2 /2) lg (n/4)) +n ≤ 2 c (n 2 /2) lg (n/4) +n = cn 2 lg (n/4) + n = cn 2 lg n - 2 cn 2 +n ≤ cn 2 lg n :. T(n) = O(n 2 lg n )

9 Draw the recursion tree for the recurrence : T(n) = 2 T(n/3) + T(n/4) + n 2 Exercise 2:

10 Exercise 3: For each of the following recurrences, give an expression for the runtime T (n) if the recurrence can be solved with the Master Theorem. T (n) = 3T (n/2) + n^2 T (n) = 4T (n/2) + n^2 T (n) = 16T (n/4) + n

11 Standard notations and common functions. Substitution method,  Guess the form of the solution.  Use mathematical induction to find the constants and show that the solution works. Recursion-tree method,  Using recursion trees to generate good guesses. Master method.  T(n) = a T(n/b) + f(n).


Download ppt "1Computer Sciences. 2 GROWTH OF FUNCTIONS 3.2 STANDARD NOTATIONS AND COMMON FUNCTIONS."

Similar presentations


Ads by Google