12.07.2015 Views

A Practical Introduction to Data Structures and Algorithm Analysis

A Practical Introduction to Data Structures and Algorithm Analysis

A Practical Introduction to Data Structures and Algorithm Analysis

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

28 Chap. 2 Mathematical PreliminariesExample 2.1 For the integers, = is an equivalence relation that partitionseach element in<strong>to</strong> a distinct subset. In other words, for any integer a, threethings are true.1. a = a,2. if a = b then b = a, <strong>and</strong>3. if a = b <strong>and</strong> b = c, then a = c.Of course, for distinct integers a, b, <strong>and</strong> c there are never cases wherea = b, b = a, or b = c. So the claims that = is symmetric <strong>and</strong> transitive arevacuously true (there are never examples in the relation where these eventsoccur). But because the requirements for symmetry <strong>and</strong> transitivity are notviolated, the relation is symmetric <strong>and</strong> transitive.Example 2.2 If we clarify the definition of sibling <strong>to</strong> mean that a personis a sibling of him- or herself, then the sibling relation is an equivalencerelation that partitions the set of people.Example 2.3 We can use the modulus function (defined in the next section)<strong>to</strong> define an equivalence relation. For the set of integers, use the modulusfunction <strong>to</strong> define a binary relation such that two numbers x <strong>and</strong> y arein the relation if <strong>and</strong> only if x mod m = y mod m. Thus, for m = 4,〈1, 5〉 is in the relation because 1 mod 4 = 5 mod 4. We see that modulusused in this way defines an equivalence relation on the integers, <strong>and</strong> this relationcan be used <strong>to</strong> partition the integers in<strong>to</strong> m equivalence classes. Thisrelation is an equivalence relation because1. x mod m = x mod m for all x;2. if x mod m = y mod m, then y mod m = x mod m; <strong>and</strong>3. if x mod m = y mod m <strong>and</strong> y mod m = z mod m, then x modm = z mod m.A binary relation is called a partial order if it is antisymmetric <strong>and</strong> transitive. 2The set on which the partial order is defined is called a partially ordered set or aposet. Elements x <strong>and</strong> y of a set are comparable under a given relation if either2 Not all authors use this definition for partial order. I have seen at least three significantly differentdefinitions in the literature. I have selected the one that lets < <strong>and</strong> ≤ both define partial orders on theintegers, because this seems the most natural <strong>to</strong> me.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!