






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!







First problem of homework Docsity.com
"How many" ways are there to do something? "How many" outcomes are there for an experiment? So far, we know about best case (O(f)) and worst case (Ω(f)) behavior. But we might want to know average case behavior. Average case behavior is a function of input. Key idea: what characterizes input? How can we describe it? Where we're going: Counting Docsity.com
Lemma: For a set of n elements, there are 2 n subsets. Sketch of proof: There are 2 options for each element: in or out. Apply the product rule n-1 times to get 2n options. Independence: whether x is in the subset doesn't determine whether y is in the subset. Example: subsets Docsity.com
The permutations of n (distinct) things are the number of ways they can be ordered. Lemma: There are n! = n(n-1)…1 permutations of n distinct things.! = factorial Proof: Basis: n=1, 1 order possible(!). Order the first n things. before the first one in the middle after the last one Put the last thing either and there are n+1 options. Inductive step: Assume there are n! ways to order n things. Then for n+1 things, Thus for n+1 things there are (n+1)n! orders = (n+1)! Example: permutations Docsity.com
How many 8-character passwords can be made from both upper- and lower-case letters? A: there are 26+26=52 choices for each letter, and there are 8 slots, so there are 52 8 =53459728531456 options. Q: Why do people guess other peoples' passwords? A: there are a lot less 8-character words. Q: How do you pick a really good password? A: use a sentence, not a word! "to be or not to be" 2b||!2b Example: passwords Docsity.com
If one thing can be done in either n ways or m ways, and there are no overlaps between the two kinds of ways, then the total count of ways is n+m. The sum rule Docsity.com
For two sets of things A and B: |AUB| = |A|+|B|-|A∩B| The number of things in the union is the sum of the numbers of things in each set minus the number of things they have in common. In other words: |A|+|B| double counts the intersection. Inclusion/exclusion principle Docsity.com