Data Str & Algorithm HW Solutions 6

Data Str& - b and b is older than c a is older than c(d Not a partial ordering since it is not antisymmetric for any pair of sis-ters(e Not

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
6 Chap. 2 Mathematical Preliminaries (d) This is not an equivalance relation since it is not symmetric. For exam- ple, a =1 and b =2 . (e) This is an eqivalance relation that divides the rationals based on their fractional values. It is re f exive since for all a , a a =0 . It is symmetric since if a b = x then b a = x . It is transitive since any two rationals with the same fractional value will yeild an integer. (f) This is not an equivalance relation since it is not transitive. For exam- ple, 4 2=2 and 2 0=2 ,but 4 0=4 . 2.3 A relation is a partial ordering if it is antisymmetric and transitive. (a) Not a partial ordering because it is not transitive. (b) Is a partial ordering bacause it is antisymmetric (if a is an ancestor of b , then b cannot be an ancestor of a ) and transitive (since the ancestor of an ancestor is an ancestor). (c) Is a partial ordering bacause it is antisymmetric (if a is older than b , then b cannot be older than a ) and transitive (since if a is older than
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: b and b is older than c , a is older than c ). (d) Not a partial ordering, since it is not antisymmetric for any pair of sis-ters. (e) Not a partial ordering because it is not antisymmetric. (f) This is a partial ordering. It is antisymmetric (no violations exist) and transitive (no violations exist). 2.4 A total ordering can be viewed as a permuation of the elements. Since there are n ! permuations of n elements, there must be n ! total orderings. 2.5 This proposed ADT is inspired by the list ADT of Chapter 4. void clear(); void insert(int); void remove(int); void sizeof(); bool isEmpty(); bool isInSet(int); 2.6 This proposed ADT is inspired by the list ADT of Chapter 4. Note that while it is similiar to the operations proposed for Question 2.5, the behaviour is somewhat different. void clear(); void insert(int); void remove(int); void sizeof();...
View Full Document

This note was uploaded on 12/27/2011 for the course MAP 2302 taught by Professor Bell,d during the Fall '08 term at UNF.

Ask a homework question - tutors are online