Download presentation
Presentation is loading. Please wait.
Published byGeorgiana Webster Modified over 9 years ago
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
6
Definition: reflexive, transitive, anti-symmetric Equality relation: xRy if x=y Is it a partial order? A. Yes B. No
7
Partial order
9
Total order
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
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
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
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.