UCSD CSE 21, Spring 2014 Mathematics for Algorithm and System Analysis Week2 Class URL: http://vlsicad.ucsd.edu/courses/cse21-s14/ Week 2 Discussion • UCSD CSE 21, Spring 2014 • Administrivia – From now on attendance at this discussion section is counted via clicker questions • • • • • A: I understand. B: I understand. C: I understand. D: I understand. E: I understand. Administrivia • From now on attendance in this discussion is counted via clicker questions • Homework Two is due 4/13/2014 • Midterm In-class on May 1 (ABK) and May 2 (RRR) – 30% of final grade • This week: – Lists without repetitions – Sets Administrivia • Personnel changes in CSE21 – I am now covering both Monday sections – Jay Dessai is no longer a TA for this class – TUTORS!!!! • Kacy Raye Espinoza – krespinoza@ucsd.edu • Tracy Nham – tnham@ucsd.edu • Hours TBD Review (Theroems / Def’s) • Cartesian Product : Generalization of Cartesian plane (RxR) • Lexicographic Order : Generalization of alphabetical order • Rule of Sum: Size of disjoint union is sum of size of components • Rule of Product: Sequence of k choices. The ith choice can be made in ci ways. Total number of structures is c1 x … x ck Review (Technique) • Stars and Bars ( Combinatoric counting method ) – Number 8 from HW1: – “A monotone increasing number consists of digits taken from the set {1, 2, …, 9}, with each digit greater than or equal to its neighbor digit to the left (if that digit exists). E.g., 1112256888899 is a monotone increasing number with 13 digits. How many 6-digit monotone increasing numbers are there? ” – Applicable Theorem: – For any pair of natural numbers n and k, the number of distinct n-tuples of non-negative integers whose sum is k is given by the binomial coefficient ð+ð−1 ð Review (Technique) • Stars and Bars ( Combinatoric counting method ) – Number 8 from HW1: – Applicable Theorem: – For any pair of natural numbers n and k, the number of distinct n-tuples of non-negative integers whose sum is k is given by the binomial coefficient ð+ð−1 ð – The things we’re actually counting are not actually {1,2,…,9} – They’re stars and bars! Review (Technique) • Stars and Bars ( Combinatoric counting method ) – Number 8 from HW1: – Answer is 9+6−1 6 – Why is k = 6 ? – k = 6 because there are 6 – 1 = 5 divisions between the digits – n = 9 because we have 9 possible items Subsets • Example: Consider set S = { x, y, z } – How many 2-lists does S generate? • A: 3 • B: 6 • C: 9 • D: 8 • E: 0 Subsets • Example: Consider set S = { x, y, z } – How many 2-lists does S generate? • A: 3 • B: 6 • C: 9 • D: 8 • E: 0 Subsets • Example: Consider set S = { x, y, z } – How many 2-lists without repetitions? • A: 3 • B: 6 • C: 9 • D: 8 • E: 0 Subsets • Example: Consider set S = { x, y, z } – How many 2-lists without repetitions? • A: 3 • B: 6 • C: 9 • D: 8 • E: 0 Subsets • Example: Consider set S = { x, y, z } – How many 2-sets which are subsets? • A: 3 • B: 6 • C: 9 • D: 8 • E: 0 Subsets • Example: Consider set S = { x, y, z } – How many 2-sets which are subsets? • A: 3 • B: 6 • C: 9 • D: 8 • E: 0 Subsets • Example: Consider set S = { x, y, z } – 2-lists: there are 32 = 9 – 2-lists without repetitions: 3*2 = 6 – 2-sets which are subsets: ??? How many??? » { x, y } { x, z } { y, z } Theorem 7: k-subsets of an n-set • Proof: Each k-subset is the set of elements of k! klists without repetitions! Up Next: Probability! • Counting and Probability go hand in hand • Here is a game that demonstrates this