{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

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

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

View Full Document Right Arrow Icon
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
Image of page 1

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

View Full Document Right Arrow Icon
(a) Trace the execution of func(2, 5). That is, give a table showing the values of the
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    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.

    Student Picture

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

  • Left Quote Icon

    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.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    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.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern