This preview shows pages 1–2. 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: CSE 21: Solutions  Problem Set 4 1. These problems are variations of Bars and Stars . Let x 1 + x 2 + x 3 + x 4 = n be the equation. (a) This is of the standard form: there are n stars, and we need 3 bars. The answer is ( n +3 3 ) . (b) If all four variable are positive, transform the equation to ( x 1 1)+( x 2 1)+( x 3 1)+( x 4 1) = n 4. Change variables: x i 1 y i . Then y 1 + y 2 + y 3 + y 4 = n 4. There is a bijection between positive solutions to x i s and nonnegative solutions to y i s. Thus the number of solutions (to both equatiosn) is ( n 4+3 3 ) . The probability is ( n 1 3 ) / ( n +3 3 ) . (c) Transform the equation to ( x 1 +2)+( x 2 +2)+( x 3 +2)+( x 4 +2) = n +8. The answer is ( n +8+3 3 ) . (d) Transform the equation to (8 x 1 ) + (8 x 2 ) + (8 x 3 ) + (8 x 4 ) = 32 n . The answer is ( 32 n +3 3 ) . 2. (a) Let m be the size of the multisets, and n be the alphabet size. As shown in class, we can either use Stars and Bars , or transform it into counting subsets. The answer is, or transform it into counting subsets....
View
Full
Document
This note was uploaded on 12/03/2009 for the course CSE 21 taught by Professor Graham during the Spring '07 term at UCSD.
 Spring '07
 Graham
 Algorithms

Click to edit the document details