Professional Documents
Culture Documents
HTTPSWWW - Ics.uci - Edu iraniw17-6DBoardNotes20 SubsetsWithRepetitionsPost PDF
HTTPSWWW - Ics.uci - Edu iraniw17-6DBoardNotes20 SubsetsWithRepetitionsPost PDF
with Repetitions
ICS 6C
Sandy Irani
Multi-sets
• A Multi-set can have more than one copy of
an item.
– Order doesn’t matter
– The number of elements of each type does
matter:
{1, 2, 2, 2, 3, 4, 5, 7, 7}
{1, 2, 2, 2, 3, 4, 7, 5, 7}
{1, 2, 2, 3, 4, 5, 7, 7}
Counting Problem with Multi-sets
• You are purchasing a dozen donuts.
• The bakery has four varieties of donuts:
Chocolate, Glazed, Jelly, Maple
• Donuts of the same variety are the same.
• There is an unlimited supply of each variety.
(For this problem at least 12 of each variety).
3 chocolate
1 glazed
6 jelly
2 maple
Donut Selection
• Binary encoding that uniquely specifies a
selection of donuts:
• Bijection:
Selection of donuts ↔ Binary code word
Number of Number of
donuts varieties - 1
Code Words to Donut Selections
• 001000101000000
• 100010000100000
• 110000000000001
Donut Selection
• Bijection:
• Ways to select 12 donuts from 4 varieties
• Binary strings with 12 0’s and (4-1) 1’s
n m 1
m 1
CCGGGGJJJJJM
001000010000010
Counting Multisets
• How many ways to distribute 10 identical
prizes to a class with 200 students?
Solution to Sums of Variables
• How many solutions are there to the following
equation, where each variable xi is a non-negative
integer?
x1 + x2 + x3 + x4 = 12
x1 = 2
x2 = 4
001000010000010
x3 = 5
x4 = 1
Lower Bounds
• How many ways to select 12 donuts from 4 varieties
(choc, glazed, jelly, maple) with the added constraint
that there are at least 2 chocolate donuts?
– First pick the 2 chocolate donuts.
– Then select the remaining 10 donuts with no restrictions.
Solution to Sums of Variables
• How many solutions are there to the following
equation, where each variable xi is a non-negative
integer?
x1 + x2 + x3 + x4 = 12
x2 ≥ 1 and x4 ≥ 3 .
Balls into Bins
• How many ways to throw 12 identical balls
into 4 distinct bins with at least two in each
bin?
distinguishable
balls
indistinguishable
balls
Balls Into Bins
How many ways are there to put 3 indistinguishable balls
into 5 distinguishable bins with at most one per bin?