{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

sol4 - CSE 21 Solutions Problem Set 4 1 These problems are...

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

View Full Document Right Arrow Icon
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 non-negative 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 ( m + n - 1 n - 1 ) . (b) Let the functions be from [ m ] to [ n ]. It’s easy to see that the collection of function values is a multiset of size m
Background image of page 1

Info iconThis 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 ]}