1 / 35

CS 173: Discrete Mathematical Structures

cain
Download Presentation

CS 173: 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 173: Discrete Mathematical Structures Cinda Heeren heeren@cs.uiuc.edu Rm 2213 Siebel Center Office Hours: M 11a-12p

    2. Cs173 - Spring 2004 CS 173 Announcements Homework 3 returned in section this week. Homework 4 available. Due 09/24, 8a.

    3. Cs173 - Spring 2004 CS 173 Functions - misc. properties f-1(?) = ? f-1(A U B) = f-1(A) U f-1(B) f-1(A ? B) = f-1(A) ? f-1(B)

    4. Cs173 - Spring 2004 CS 173 Functions - injection A function f: A ? B is one-to-one (injective, an injection) if ?a,b,c, (f(a) = b ? f(c) = b) ? a = c

    5. Cs173 - Spring 2004 CS 173 Functions - surjection A function f: A ? B is onto (surjective, a surjection) if ?b ? B, ?a ? A f(a) = b

    6. Cs173 - Spring 2004 CS 173 Functions - bijection A function f: A ? B is bijective if it is one-to-one and onto.

    7. Cs173 - Spring 2004 CS 173 Functions - examples Suppose f: R+ ? R+, f(x) = x2. Is f one-to-one? Is f onto? Is f bijective?

    8. Cs173 - Spring 2004 CS 173 Functions - examples Suppose f: R ? R+, f(x) = x2. Is f one-to-one? Is f onto? Is f bijective?

    9. Cs173 - Spring 2004 CS 173 Functions - examples Suppose f: R ? R, f(x) = x2. Is f one-to-one? Is f onto? Is f bijective?

    10. Cs173 - Spring 2004 CS 173 Functions - composition Let f:A?B, and g:B?C be functions. Then the composition of f and g is: (g o f)(x) = g(f(x))

    11. Cs173 - Spring 2004 CS 173 Functions - a little problem Let f:A?B, and g:B?C be functions. Prove that if f and g are one to one, then g o f :A?C is one to one.

    12. Cs173 - Spring 2004 CS 173 Functions - another Let f:A?B, and g:B?C be functions. Prove that if f and g are onto, then g o f :A?C is onto.

    13. Cs173 - Spring 2004 CS 173 Familiar functions Polynomials: f(x) = a0xn + a1xn-1 + … + an-1x1 + anx0 Ex: f(x) = x3 - 2x2 + 15 Exponentials: f(x) = cdx Ex: f(x) = 310x, f(x) = ex Logarithms: log2 x = y, where 2y = x.

    14. Cs173 - Spring 2004 CS 173 Familiar functions Ceiling: f(x) = ?x? the least integer y so that x ? y. Ex: ?1.2? = 2; ?-1.2? = -1; ?1? = 1 Floor: f(x) = ?x? the greatest integer y so that x ? y. Ex: ?1.8? = 1; ?-1.8? = -2; ?-5? = -5 Quiz: what is ?-1.2 + ?1.1?? ?

    15. Cs173 - Spring 2004 CS 173 Two example algorithms. Suppose we wish to find the maximum number in a sequence of n numbers. How long should we spend doing this?

    16. Cs173 - Spring 2004 CS 173 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?

    17. Cs173 - Spring 2004 CS 173 Who wins the race? The following graph gives times for completing races of length x, for 4 different competitors.

    18. Cs173 - Spring 2004 CS 173 Quiz time… Describe these functions:

    19. Cs173 - Spring 2004 CS 173 Quiz time… Describe this function:

    20. Cs173 - Spring 2004 CS 173 Quiz time… Describe this function:

    21. Cs173 - Spring 2004 CS 173 Quiz time… Describe this function:

    22. Cs173 - Spring 2004 CS 173 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

    23. Cs173 - Spring 2004 CS 173 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)

    24. Cs173 - Spring 2004 CS 173 Growth of functions f(x) = O(g(x)) iff ? c,k so that ? x>k, f(x) ? c·g(x)

    25. Cs173 - Spring 2004 CS 173 Growth of functions (examples) f(x) = O(g(x)) iff ? c,k so that ? x>k, f(x) ? c·g(x)

    26. Cs173 - Spring 2004 CS 173 Growth of functions (examples) f(x) = O(g(x)) iff ? c,k so that ? x>k, f(x) ? c·g(x)

    27. Cs173 - Spring 2004 CS 173 Growth of functions (examples) f(x) = O(g(x)) iff ? c,k so that ? x>k, f(x) ? c·g(x)

    28. Cs173 - Spring 2004 CS 173 Growth of functions (examples) f(x) = O(g(x)) iff ? c,k so that ? x>k, f(x) ? c·g(x)

    29. Cs173 - Spring 2004 CS 173 Growth of functions (examples) f(x) = O(g(x)) iff ? c,k so that ? x>k, f(x) ? c·g(x)

    30. Cs173 - Spring 2004 CS 173 Growth of functions (examples)

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

    32. Cs173 - Spring 2004 CS173 Growth of functions (more examples) So

    33. Cs173 - Spring 2004 CS173 Growth of functions - a theorem If f1(x) = O(g1(x)) and f2(x)=O(g2(x)), then f1(x) + f2(x) = O(max{g1(x),g2(x)})

    34. Cs173 - Spring 2004 CS173 Growth of functions - a corollary We know: If f1(x) = O(g1(x)) and f2(x)=O(g2(x)), then f1(x) + f2(x) = O(max{g1(x),g2(x)})

    35. Cs173 - Spring 2004 CS173 Growth of functions - another theorem If f1(x) = O(g1(x)) and f2(x)=O(g2(x)), then f1(x)·f2(x) = O(g1(x)·g2(x))

More Related