Continuing in this fashion we find the answer is

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 2 = 16,777,214. Continuing in this fashion we find the answer is: 3,737,091,842 (3.7 billion IP addresses) 12 Subtraction Rule If a task can be done in either n1 ways or n2 ways, then the number of ways to do the task is n1+n2 minus the number of ways to do the task that is common to the two different ways. Principle of Inclusion-and-Exclusion: Let S1 and S2 be sets. Then |S1 ∪ S2| = |S1|+|S2| - |S1 ∩ S2| 13 Subtraction Rule: Example 1 How many bit strings of length 8 either start with a 1 bit or end with the last two bits equal to 00 ? Let S1 be the set of bit strings of length 8 that start with 1. Then |S1| = 27=128. Let S2 be the set of bit strings of length 8 that end with 00. Then |S2|=26=64. Furthermore, the set of bit strings of length 8 that start with bit 1 and end with bits 00 has cardinality |S1 ∩ S2| = 25=32. Thus, the answer is |S1 ∪ S2|=|S1|+|S2|-|S1 ∩ S2|=128+64-32=160. 14 Subtraction Rule: Example 2 Let us consider some (slightly simplified) rules for passwords: Passwords must be 2 characters long. Each character must be a) a letter [a-z], b) a digit [0-9], or c) one of the 10 special characters [!@#$%^&*()]. Each password must contain at least 1 digit or special character. 15 Subtraction Rule: Example 2 (Cont.) A legal password has a digit or a special character in position 1 or position 2. These cases overlap, so the subtraction rule applies. (# of passwords with valid symbol in position #1) = (10+10)·(10+10+26)=20·46 (# of passwords with valid symbol in position #2) = 20·46 (# of passwords with valid symbols in both places): 20·20 Answer: 920+920−400 = 1,440 16 Pigeonhole Principle If k+1 objects are assigned to k places, then at least one place must be assigned at least two objects. 17 Generalized Pigeonhole Principle Theorem: If N > k objects are assigned to k places, then at least one place must be assigned at least ȺN/kȺ objects. Proof: Seeking a contradiction, suppose every place has less than ȺN/kȺ objects; so at most ≤ ȺN/kȺ−1 objects per place. Then the total number of objects is at most k ￿￿ N k ￿ ￿ ￿￿ ￿ ￿ N −1 <k + 1 − 1 = k (N/k ) = N k Thus, there...
View Full Document

Ask a homework question - tutors are online