{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# hw4-solutions - CS 173 Discrete Structures Fall 2010...

This preview shows pages 1–3. Sign up to view the full content.

CS 173: Discrete Structures, Fall 2010 Homework 4 Solutions This homework contains 6 problems worth a total of 47 points. It is due on Friday, September 24th at 4pm. 1. Set Operations [12 points] Suppose you were given the following sets: A = { Vine , Tree , Shrub } B = {{ Tree }} C = { Vine , Moss } D = { Red , Green } E = { Red } List the elements of the set for the following expressions: (a) A B C (b) A B (c) D × C (d) P ( B E ) (e) | A × P ( A D ) | (f) { S P ( A D ) : | S | is a multiple of 4 } Solution: (a) { Vine , Tree , Shrub , { Tree } , Moss } (b) . Notice that Tree isn’t equal to { Tree } . (c) { (Red , Vine) , (Red , Moss) , (Green , Vine) , (Green , Moss) } (d) {∅ , { Red } , {{ Tree }} , {{ Tree } , Red }} (e) 96. | A | = 3 and | P ( A D ) | = 2 5 = 32 (f) {∅ , { Vine , Tree , Shrub , Red } , { Vine , Tree , Shrub , Green } , { Tree , Shrub , Green , Red } , { Vine , Shrub , Green , Red } , { Vine , Tree , Green , Red }} 1

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
2. Euclidean algorithm [4 points] Trace the execution of the Euclidean algorithm (lecture 10 or p 229 in Rosen) on the inputs a = 2040 and b = 2737. That is, give a table showing the values of the main variables ( x , y , r ) for each pass through the loop. Explicitly indicate what the output value is. Solution: x y r 2040 2737 2040 2737 2040 697 2040 697 646 697 646 51 646 51 34 51 34 17 34 17 0 17 0 [halts] The output value is 17. 3. [8 points] Direct Proof Using Congruence mod k There are several possible (and equivalent) ways to define congruence mod k. For this problem, use the following definition: for any integers x and y
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern