This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: CS161: Design and Analysis of Algorithms Summer 2004 Problem Set #2 Solutions General Notes Regrade Policy: If you believe an error has been made in the grading of your problem set, you may resubmit it for a regrade. If the error consists of more than an error in addition of points, please include with your problem set a detailed explanation of which problems you think you deserve more points on and why. We reserve the right to regrade your entire problem set, so your final grade may either increase or decrease. Remember you can only split an expectation of a product into the product of the expectations if the two terms are independent . Many students did this on question 3c either without justification or justifying it as linearity of expectation, which is incorrect. For the skip list question 4b, many students found the expected number of nodes between left [ i + 1] .below and right [ i + 1] .below by saying the expected number of nodes at level i + 1 is np i +1 and the expected number of nodes at level i is np i . Then, if you divide the number of nodes at i by the number at i + 1, you get an average interval of 1 /p . While this gives the correct answer, it is not a valid argument as it stands. For example, lets say you always propagate the first nodes in level i you will get an interval of length 1 with probability 1 /p and an interval of length np i (1 p ) with probability 1 1 /p , which clearly gives you a different expectation. You need to use properties other than just the expected number of nodes to calculate the expected interval length. 1. [18 points] Probability and Conditional Probability Throughout this problem, please justify your answers mathematically as well as logically; however, you do not have to give any formal proofs. (a) [5 points] Do problem C.29 on page 1106 of CLRS. Assume that initially, the prize is placed behind one of the three curtains randomly. Answer: The answer is not 1 / 2, because now the two curtains are no longer equally likely to hide the prize. In fact, the original 3 cases are still equally likely, but now in two of the cases the prize is behind the curtain that is not revealed or chosen. Therefore, the probability of winning if you stay is 1 / 3, if you switch is 2 / 3. (b) [5 points] Do problem C.210 on page 1106 of CLRS. Answer: This is essentially the same problem, except now there is no option to switch. The prisoners are the curtains, freedom is the prize, and the guards revelation is equivalent to the emcees revelation in the previous question. Thus, the probability that X will go free is 1 / 3. Problem Set #2 Solutions 2 (c) [8 points] Consider the following game using a standard 52card deck (with 26 red cards and 26 black cards): i. the deck D is shuffled randomly....
View Full
Document
 Summer '09
 Algorithms

Click to edit the document details