{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Data Str &amp; Algorithm HW Solutions 6

# Data Str &amp; Algorithm HW Solutions 6 - b and b is...

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

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 fl 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
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

{[ snackBarMessage ]}