{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# hw4 - CS 173 Discrete Structures Spring 2010 Homework 4...

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

CS 173: Discrete Structures, Spring 2010 Homework 4 This homework contains 5 problems worth a total of 50 points. It is due on Friday, 19 February at 4pm. 1. Set Operations [16 points] Suppose you were given the following sets: A = { Piano , { Violin , Viola , Cello } , Guitar } B = {{ Flute, Piccolo } , Cymbals } C = { Piano , Flute } D = {{ Violin, Viola, Cello } , { Flute, Piccolo }} List the elements of the set for the following expressions: (a) A D (b) B C (c) A - ( B - C ) (d) A P ( B C ) (e) ( B D ) × C (f) | P ( B D ) | (g) { X P ( A ) : | X | is not prime } (h) { X ( P ( A ) P ( B )) : | X | ≡ 3 (mod 2) } 2. Euclidean algorithm [4 points] Trace the execution of the Euclidean algorithm (lecture 10 or p 229 in Rosen) on the inputs a = 837 and b = 2015. 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. 3. Pseudocode [10 points] procedure func(a, b: natural numbers) if (b = 0) return 1 if (b = 1) return a m := func(a, floor(b/2)) p := func(a, (b mod 2)) return m * m * p 1

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

View Full Document
(a) Trace the execution of func(2, 5). That is, give a table showing the values of the
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