{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Problem Set 6 Solutions

Problem Set 6 Solutions - CSE 21 Solutions Problem Set 6...

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

View Full Document Right Arrow Icon
CSE 21: Solutions - Problem Set 6 1. X Y Pr ( X, Y ) 1 0 . 1 2 0 . 04 Y = 1 1 0 . 2 0 . 5 1 0 . 06 root 0 . 6 0 . 2 0 . 2 2 0 . 1 0 . 6 2 0 . 36 Y = 2 3 0 . 4 0 . 4 1 0 . 08 2 0 . 08 Then Pr ( Y = 1) = 0 . 1 + 0 . 06 + 0 . 08 = 0 . 24 Pr ( Y = 2) = 0 . 04 + 0 . 36 + 0 . 08 = 0 . 48 2. (a) CS21E, CS12E, SC21E, SC12E, E12CS, E21CS, E12SC, E21SC; (b) AAA, AABA, AABBA, AABBB, ABAA, ABABA, ABABB, ABBAA, ABBAB, ABBB. 3. (a) a + b - 1 (from lecture). (b) If we merge a and b first, we need a + b - 1 comparisons, and we get a list of length a + b . Then we merge this longer list into c , which requires ( a + b ) + c - 1 comparison. The total number of comparisons is ( a + b - 1) + ( a + b ) + c - 1 = 2 a + 2 b + c - 2 = 2( a + b + c - 1) - c. Note that, if we firs merge b and c , the number is 2( a + b + c - 1) - a ; if we first merge a and c , the number is 2( a + b + c - 1) - b . So, the best way is to merge two shortest lists first. Therefore, our answer is 2( a + b + c - 1) - max { a, b, c } . (c) For this part, it’s hard to derive a precise calculation for general k . Here we assume that k has the form 2 m , i.e., dividing k by 2 many times still gives us an integer. This assumption is often made in analysis of complexity of algorithms where people only care about asymptotic efficiency.
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
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