CSE390D Notes for Wednesday, 11/6/24

Pigeon Hole Principle: k holes, k + 1 items, some hole has at least 2 items example: cards, suits, how many cards to have 2 of same suit? 5 generalized: k holes, n items, some hole has ceil(n/k) items example: cards, suits, how many cards to have 3 of same suit? 9, 4? 13 ------------------------------------------------------------------------------- big example: think about sortedness (partial sorting) for sequences of length 17, as in: 4, 22, 8, 15, 19, 11, 2, 1, 9, 20, 10, 7, 16, 3, 6, 5, 14 This has increasing sequences of length 5, as in (4, 8, 15, 19, 20) and decreasing sequences up to length 7, as in (22, 19, 11, 10, 7, 6, 5) how scrambled can it be? every sequence of n^2+1 distinct numbers has subsequence of length n+1 that is strictly increasing or strictly decreasing for 17 items, 17=4^2+1, so most scrambled is 5 proof: proof by contradiction suppose not (in other words, assume p ^ ~q) There is a sequence of length n^2+1 where each subsequence has a length <= n let sequence = (a1, a2, ..., a(n^2+1)) consider (ik, dk): ik = length of longest increasing sequence starting at ak dk = length of longest decreasing sequence starting at ak do some specific pairs from sample list what kinds of numbers can you get? 1 <= ik <= n (always at least 1, proof assumes <= n) 1 <= dk <= n So how many pairs? n^2 How many k's are there? n^2+1 So?...by pigeon hole principle, some pair matches: Let (ij, dj) = (ik, dk) with j < k two possibilities: aj < ak: then aj followed by longest increasing sequence starting at ak leads to increasing sequence of length n+1 (contradiction) aj > ak: then aj followed by longest decreasing sequence starting at ak leads to decreasing sequence of length n+1 (contradiction) qed ------------------------------------------------------------------------------- permutations: permutation of objects = ordered sequence of those objects how many ways to arrange n items in order? n! r-permutation = how many permutations of r items taken from a set of n items? P(n, r) = n! / (n-r)! combination of objects = unordered set of objects r-combination = how many combinations of r items taken from a set of n items? C(n, r) = n! / [r! * (n-r)!] Problems: 23 acm teams, ways to pick 1st/2nd/3rd? P(23, 3) = 23!/20! 38 students in a class how many ways to seat them in 38 chairs? 38! how many ways to fill front row of 5 chairs? P(38, 5) = 38!/33! how many ways to pick 6 winners of a candy bar? C(38, 6) = 38!/(6! * 32!) how many ways to pick 32 losers of a candy bar? C(38, 32) = 38!/(32! * 6!) *mention how these are equal...book shows two ways to prove this...algebra or *counting argument Poker hands with 52-card deck? C(52, 5) = 52! / (5! * 47!) how many binary strings of length 10 with exactly 3 0's? C(10, 3) = 10! / (3! * 7!) problem 33 from section 6.3 26 letters = 21 consonants + 5 vowels how many length 6 sequences have: a) exactly one vowel? 5 (vowels) * 6 (positions) * 21^5 (others) b) exactly two vowels? 5 (vowels) * 5 (vowels) * C(6, 2) (pos) * 21^4 c) at least one vowel? 26^6 - 21^6 d) at least two vowels? 26^6 - 21^6 - (part a)
Stuart Reges
Last modified: Wed Nov 6 15:31:32 PST 2024