1. Trang chủ
  2. » Giáo án - Bài giảng

Discrrete mathematics for computer science counting subsets

13 42 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 13
Dung lượng 195,12 KB

Nội dung

Counting Subsets Permutations • • • • • • How many arrangements of n = 52 cards? First card can be any of 52 Second card can be any of the remaining 51 … Once you have chosen 51 there is only one choice for the last So by the product rule, n ∙ (n-1) ∙ (n-2) ∙ … ∙ 2.1 = n! How Many 4-Letter Words Using Each Letter at Most Once? • • • • • • 26 choices for first letter Only 25 for second letter 24 for third letter 23 for fourth letter So 26∙25∙24∙23 or 26!/22! Generalized Product Rule • • Let Q be a set of length-k sequences • |Q| = n1⋅n2⋅⋅⋅nk if n1 possible 1st elements, n2 possible 2nd elements (for each first entry), n3 possible 3rd elements (for each 1st & 2nd entry, ) then, How Many Hands with Cards? • • • • I.e., how many 5-element subsets of a set with 52 elements? We know there are 52! sequences of 52 cards Each sequence uniquely identifies a set of cards: the first Many-to-one mapping from sequences of 52 cards to sets of cards! • • • map sequence a1a2a3a4…a52 to set {a1,a2,a3,a4,a5} • For each of those, any way of permuting the last 47 elements maps to the same set How many different sequences map to the same set? Any way of permuting the first elements maps to the same set (5! ways) 6any4permutation ανψ 64περ7µ υτατιον 48 a1a2 a3a4 a5 a6 …α52 → {α1 , α2 , α3 , α4 , α5 } Counting Subsets • • • By the product rule, 5!∙47! different sequences map to the same set Therefore the number of 5-element subsets of a set of 52 elements is 52include  52  The number of ways52! of picking 5 cards to is the same as =  47cards =  to omit! the number of ways of picking  5!47!    47  “n Choose m” • The number of m-element subsets of a set of size n is n   ν  ν!  m  = µ !(ν − µ !) =  ν − µ  Counting Doughnut Selections From kinds of doughnuts select a dozen let A ::= all selections of 12 doughnuts 00  (none)  chocolate lemon 000000  00     00 sugar glazed plain 3/22/19 lec 10W.9 Counting Doughnut Selections B::= 16-bit words with four 1’s 0011000000100100 00   00 00 100 000000 00 00      000000 chocolate lemon sugar glazed plain Bijection A↔B so |A|=|B| 3/22/19 10 • # of 16-bit-strings with 1’s = # of ways of choosing from the set of possible positions {1, …, 16} =  16    3/22/19 11 How Many Poker Hands (5 cards) with Jacks?  48  of picking three non-jacks ways   •  of picking two jacks ways   • • So by the product rule the number of hands with exactly jacks is  48    48!⋅ 4!   γ   = 3!⋅ 45!⋅ 2!⋅ 2! = 103776 FINIS ... …α52 → {α1 , α2 , α3 , α4 , α5 } Counting Subsets • • • By the product rule, 5!∙47! different sequences map to the same set Therefore the number of 5-element subsets of a set of 52 elements is... n2 possible 2nd elements (for each first entry), n3 possible 3rd elements (for each 1st & 2nd entry, ) then, How Many Hands with Cards? • • • • I.e., how many 5-element subsets of a set with 52... one choice for the last So by the product rule, n ∙ (n-1) ∙ (n-2) ∙ … ∙ 2.1 = n! How Many 4-Letter Words Using Each Letter at Most Once? • • • • • • 26 choices for first letter Only 25 for second

Ngày đăng: 22/03/2019, 11:18

TỪ KHÓA LIÊN QUAN