Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSE 20 DISCRETE MATH Prof. Shachar Lovett Clicker frequency: CA.

Similar presentations


Presentation on theme: "CSE 20 DISCRETE MATH Prof. Shachar Lovett Clicker frequency: CA."— Presentation transcript:

1 CSE 20 DISCRETE MATH Prof. Shachar Lovett http://cseweb.ucsd.edu/classes/wi15/cse20-a/ Clicker frequency: CA

2 Todays topics Order relations Section 6.3 in Jenkyns, Stephenson

3 Order relations

4 Partial order

5

6 Definition: reflexive, transitive, anti-symmetric Equality relation: xRy if x=y Is it a partial order? A. Yes B. No

7 Partial order

8

9 Total order

10

11

12 Lexicographic order

13 Orders on sequences Which one of the following is the largest one? A. (1,2,5,10) B. (10,5,2,1) C. (5,100,3,3) D. (10,7,100,1000)

14 Maximal / maximum elements

15

16

17 There could be multiple maximal elements in a set, but the maximal element (if it exists) must be unique Lets prove it

18 Maximal / maximum elements

19 Minimal / minimum elements

20 Maximum/maximal/minimum/minimal

21

22

23 Back to total orders

24 Sorting Sorting is a basic primitive used by many algorithms Most sorting algorithms are “abstract”, in the sense that they can apply to any partial order Naïve sorting on n elements requires comparing all pairs of elements, which takes ~n 2 comparisons Fast sorting algorithms (for example, quicksort) can do it using only n log n comparisons This can be proven to be tight!

25 Next class Knights and knaves


Download ppt "CSE 20 DISCRETE MATH Prof. Shachar Lovett Clicker frequency: CA."

Similar presentations


Ads by Google