1 / 36

CS 23022 Discrete Mathematical Structures

CS 23022 Discrete Mathematical Structures. Mehdi Ghayoumi MSB rm 132 mghayoum@kent.edu Ofc hr: Thur, 9:30-11:30a. Announcements. Homework 4 available. Due Mon 06/23 , 8a. Midterm : Next Mon 06/30/14, location 121 . Chapter 2.3 in Rosen and some other articles And Chapter 3 in Rosen.

julian-rowe
Download Presentation

CS 23022 Discrete Mathematical Structures

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. CS 23022Discrete Mathematical Structures Mehdi Ghayoumi MSB rm 132 mghayoum@kent.edu Ofc hr: Thur, 9:30-11:30a

  2. Announcements Homework 4 available. Due Mon 06/23, 8a. Midterm : Next Mon 06/30/14, location 121. Chapter 2.3 in Rosen and some other articles And Chapter 3 in Rosen

  3. Familiar functions Polynomials: f(x) = a0xn + a1xn-1 + … + an-1x1 + anx0 A polynomial can have: A polynomial can have constants, variables and exponents, but never division by a variable.

  4. Familiar functions Degree Standard Form

  5. Familiar functions Exponentials: The exponential function with base b is defined by:

  6. Familiar functions Natural Exponential Function: This function is simply a "version" of where b >1.

  7. Familiar functions Inverse of f (x) = ex: Since  f (x) = exis a one-to-one function, weknow that its inverse will also be a function.  But what is the equation of the inverse of f (x) = ex ?To solve for an inverse algebraically:

  8. Familiar functions Other Exponential Inverses: Y=2x or y= 0.5x

  9. In this course, log2 n is written lg n. If we write log n, assume log2 n. Familiar functions Logarithms: log2 x = y, where 2y = x. f(x) = loga(x) a is any value greater than 0, except 1 Example: f(x) = log2(x) Example: f(x) = log½(x)

  10. Familiar functions Inverse loga(x)   is the Inverse Function of  ax (the Exponential Function) The Natural Logarithm Function This is the "Natural" Logarithm Function: f(x) = loge(x) Where e is "Eulers Number" = 2.718281828459 (and more ...)

  11. Familiar functions Ceiling: f(x) = x the least integer y so that x  y. Ex: 1.2 = 2; -1.2 = -1; 1 = 1

  12. Familiar functions Floor: f(x) = x the greatest integer y so that x  y. Ex: 1.8 = 1; -1.8 = -2; -5 = -5

  13. Familiar functions Cube Function Linear Function Square Function f(x) = x3 f(x) = mx + b f(x) = x2

  14. Familiar functions Reciprocal Function Square Root Function Absolute Value Function f(x) = √x f(x) = |x| f(x) = 1/x

  15. Familiar functions Logarithmic Function Exponential Function f(x) = ln(x) f(x) = ex

  16. Familiar functions Dance Moves

  17. Every unit increase in x results in the same increase in f(x). Linear functions Function types Describe these functions: f(x) x

  18. Very slow growing. Logarithmic function Function types Describe this function:

  19. Very fast growing. Exponential function Function types Describe this function:

  20. Polynomial Function types Describe this function: f(x) x

  21. In this case our algorithm takes about n time units. We say the algorithm has “order n” running time. Two example algorithms Suppose we wish to find the maximum number in a sequence of n numbers. How long should we spend doing this? Suppose it takes 1 time unit to make a comparison between two numbers.

  22. In this case the algorithm takes about lg n time units. We say the algorithm has “order log n” running time. Two example algorithms I have a number between 0 and 63. You ask a question, I’ll tell you yes or no. How long will it take you to find my secret number? Suppose it takes 1 time unit to answer a query about my number.

  23. Who is the tortoise? Who is the hare? How would you describe blue’s performance? At each distance, who wins? Who wins the race? The following graph gives times for completing races of length x, for 4 different competitors. time distance

  24. Growth of functions Algorithm analysis is concerned with: Type of function that describes run time (we ignore constant factors since different machines have different speed/cycle) Large values of x

  25. We say “f(x) is big O of g(x)” Recipe for proving f(x) = O(g(x)): find a c and k so that the inequality holds. Growth of functions Important definition: For functions f and g we write f(x) = O(g(x)) to denote  c,k so that  x>k, f(x)  c·g(x)

  26. c·g(x) g(x) We give an eventual upper bound on f(x) k Growth of functions f(x) = O(g(x)) iff  c,k so that  x>k, f(x)  c·g(x) f(x) x

  27. There’s k There’s c Growth of functions (examples) f(x) = O(g(x)) Iff  c,k so that  x>k, f(x)  c·g(x) 3n = O(15n) since  n>0, 3n  1·15n

  28. 5 8 0 5 Growth of functions (examples) f(x) = O(g(x)) iff  c,k so that  x>k, f(x)  c·g(x) 15n = O(3n) since  n>__, 15n  __·3n

  29. 1 Growth of functions (examples) f(x) = O(g(x)) iff  c,k so that  x>k, f(x)  c·g(x) x2 = O(x3) since  x> __, x2  x3

  30. 0 1000 Growth of functions (examples) f(x) = O(g(x)) iff  c,k so that  x>k, f(x)  c·g(x) 1000x2 = O(x2) since  x> __, 1000x2  ____·x2

  31. Growth of functions (examples) f(x) = O(x4).

  32. Nothing works for k Try c = 10 k = 200, c = 11 Try c = 11 200 Growth of functions (examples) Prove that 5x + 100 = O(x/2) Need  x> ___, 5x + 100  ___ · x/2  x> ___, 5x + 100  10 · x/2  x> ___, 5x + 100  5x + x/2  x> ___, 100  x/2

  33. Growth of functions Guidelines: In general, only the largest term in a sum matters. a0xn + a1xn-1 + … + an-1x1 + anx0 = O(xn) n5lg n = O(n6) List of common functions in increasing O() order: 1 (lgn ) n (n lg n) n2… 2n n!

  34. Growth of functions (more examples) Then So

  35. This is just the case where g1(x) = g2(x) = g(x) Growth of functions - a corollary If f1(x) = O(g1(x)) and f2(x)=O(g2(x)), then f1(x) + f2(x) = O(max{g1(x),g2(x)}) If f1(x) = O(g(x)) and f2(x)=O(g(x)), then f1(x) + f2(x) = O(g(x)).

More Related