1 / 31

Algorithms

Algorithms. Ch. 3 Growth of Functions Ming-Te Chi. A way to describe behavior of function in the limit. 3.1 Asymptotic notation. asymptotically tight bound.  g(n) is an asymptotic tight bound for f(n). "=" abuse equality. “is a member of” All c i and n 0 are positive numbers.

isi
Télécharger la présentation

Algorithms

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Algorithms Ch. 3 Growth of Functions Ming-Te Chi Ch3 Growth of Functions

  2. A way to describe behavior of function in the limit. 3.1 Asymptotic notation Ch3 Growth of Functions

  3. asymptotically tight bound g(n) is an asymptotic tight bound for f(n). • "=" abuse equality. “is a member of” • All ci and n0are positive numbers. Ch3 Growth of Functions

  4. The definition of required every member of be asymptotically nonnegative. Ch3 Growth of Functions

  5. Example: Ch3 Growth of Functions

  6. In general, if Ch3 Growth of Functions

  7. asymptotic upper bound Ch3 Growth of Functions

  8. asymptotic lower bound Ch3 Growth of Functions

  9. Theorem 3.1. • For any two functions f(n) and g(n), if and only if and . Ch3 Growth of Functions

  10. Remarks: • The asymptotic upper bound by O-notation may or may not be asymptotically tight. • The bound 2n2 = O(n2) is asymptotically tight, but the bound 2n = O(n2) is not. • The o-notation is used to denote an upper bound that is not asymptotically tight. • is read as “little-oh of g of n” Ch3 Growth of Functions

  11. o-notation Ch3 Growth of Functions

  12. ω-notation Ch3 Growth of Functions

  13. 5 asymptotic notations • Difference between big-oh and little-oh? • Etc. Ch3 Growth of Functions

  14. Comparing functions • Transitivity • Reflexivity • Symmetry Ch3 Growth of Functions

  15. Transpose symmetry Ch3 Growth of Functions

  16. Trichotomy (三一律) • a < b, a = b, or a > b. (only one condition holds for all real number a & b) • Not all functions are asymptotically comparable. (For two functions f and g, it may be the case that neither nor • e.g., can not be compared using the asymptotic notation. Since oscillates between 0 and 2. Ch3 Growth of Functions

  17. 2.2 STANDARD NOTATIONS AND COMMON FUNCTIONS Ch3 Growth of Functions

  18. Monotonicity • A function f is monotonically increasing • if m  n implies f(m)  f(n). • A function f is monotonically decreasing • if m  n implies f(m)  f(n). • A function f is strictly increasing • if m < n implies f(m) < f(n). • A function f is strictly decreasing • if m < n implies f(m) > f(n). Ch3 Growth of Functions

  19. Floor and ceiling Ch3 Growth of Functions

  20. Modular arithmetic • For any integer a and any positive integer n, the value a mod n is the remainder (or residue) of the quotient a/n : a mod n =a - a/n. • If(a mod n) = (b mod n). We write a b (mod n) and say that a is equivalent to b, modulo n. • We write a≢b (mod n) if a is not equivalent to b modulo n. Ch3 Growth of Functions

  21. Polynomials v.s. Exponentials • Polynomials: • Polynomial in n of degree d, a nonnegative integer. • A function is polynomial bounded if for some constant k. Ch3 Growth of Functions

  22. Polynomials v.s. Exponentials • Exponentials: • Any positive exponential function grows faster than any polynomial. Ch3 Growth of Functions

  23. Logarithms • A function f(n) is polylogarithmically bounded if , for some constant k • for any constant a > 0. • Any positive polynomial function grows faster than any polylogarithmic function. Ch3 Growth of Functions

  24. Factorials Ch3 Growth of Functions

  25. Factorials • Stirling’s approximation can be used to show Ch3 Growth of Functions

  26. Factorials • Also, for n>=1, we have where Ch3 Growth of Functions

  27. Function iteration For example, if , then Ch3 Growth of Functions

  28. The iterative logarithm function Ch3 Growth of Functions

  29. Since the number of atoms in the observable universe is estimated to be about , which is much less than , we rarely encounter a value of n such that . Ch3 Growth of Functions

  30. Fibonacci numbers Ch3 Growth of Functions

  31. Fibonacci numbers • Fibonacci numbers grow exponentially. Ch3 Growth of Functions

More Related