Chapter The Basics of Counting 5.2 The Pigeonhole Principle

Slides:



Advertisements
Similar presentations
Basic Counting Rosen 4.1. Sum Rule If a first task can be done in n 1 ways and a second task can be done in n 2 ways, and if these tasks cannot be done.
Advertisements

4/16/2015 MATH 224 – Discrete Mathematics Counting Basic counting techniques are important in many aspects of computer science. For example, consider the.
Counting Chapter 6 With Question/Answer Animations.
Recursively Defined Functions
Section 4.1: The Basics of Counting As we have seen, one way to count the number of objects in a finite set S is to produce a one-to-one correspondence.
College of Information Technology & Design
1 Combinatorics Rosen 6 th ed., § , § Combinatorics Count the number of ways to put things together into various combinations.Count the number.
Chapter 6 With Question/Answer Animations. Chapter Summary The Basics of Counting The Pigeonhole Principle Permutations and Combinations Binomial Coefficients.
Counting and Probability The outcome of a random process is sure to occur, but impossible to predict. Examples: fair coin tossing, rolling a pair of dice,
1 Section 4.1 Basics of Counting. 2 Basic Counting Principles: Sum Rule Suppose you have two tasks to perform: –The first task can be done in n 1 ways;
CSE115/ENGR160 Discrete Mathematics 04/10/12
Combinations We should use permutation where order matters
Discrete Mathematics Lecture 6 Alexander Bukharovich New York University.
Recursive Definitions Rosen, 3.4 Recursive (or inductive) Definitions Sometimes easier to define an object in terms of itself. This process is called.
1 Discrete Structures – CNS2300 Text Discrete Mathematics and Its Applications (5 th edition) Kenneth H. Rosen Chapter 4 Counting.
CS100 : Discrete Structures
Chapter 1 Fundamental principles of counting 陳彥良 中央大學資管系.
4. Counting 4.1 The Basic of Counting Basic Counting Principles Example 1 suppose that either a member of the faculty or a student in the department is.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Combinatorics.
Combinatorics 3/15 and 3/ Counting A restaurant offers the following menu: Main CourseVegetablesBeverage BeefPotatoesMilk HamGreen BeansCoffee.
Discrete Mathematics CS 2610 March 26, 2009 Skip: structural induction generalized induction Skip section 4.5.
Counting Chapter 6 With Question/Answer Animations.
Discrete Maths Objective to introduce some of the counting rules (product, sum, subtraction, division, pigeonhole) through examples , Semester 2,
Counting. Why counting  Determine the complexity of algorithms To sort n numbers, how many instructions are executed ?  Count the number of objects.
The Basics of Counting Section 6.1.
Counting. Product Rule Example Sum Rule Pigeonhole principle If there are more pigeons than pigeonholes, then there must be at least one pigeonhole.
Chapter The Basics of Counting 5.2 The Pigeonhole Principle
Fall 2002CMSC Discrete Structures1 One, two, three, we’re… Counting.
September1999 CMSC 203 / 0201 Fall 2002 Week #8 – 14/16 October 2002 Prof. Marie desJardins.
Dr. Eng. Farag Elnagahy Office Phone: King ABDUL AZIZ University Faculty Of Computing and Information Technology CPCS 222.
ICS 253: Discrete Structures I Counting and Applications King Fahd University of Petroleum & Minerals Information & Computer Science Department.
The Basics of Counting Section 6.1.
Section Section Summary The Product Rule The Sum Rule The Subtraction Rule The Division Rule Examples, Examples, and Examples Tree Diagrams.
Based on Rosen, Discrete Mathematics & Its Applications, 5e Prepared by (c) Michael P. Frank Modified by (c) Haluk Bingöl 1/37 Module.
Module #15: Combinatorics Rosen 5 th ed., §§ & §6.5 Now we are moving on to Ch. 4 It is the study of arrangement of objects e.g. enumeration, counting.
CSNB143 – Discrete Structure
CS 103 Discrete Structures Lecture 16
11.1 CompSci 102© Michael Frank Today’s topics CountingCounting –Sum rule –Product rule –Tree diagrams –Inclusion/exclusion Reading: Sections 4.1Reading:
Discrete Structures Counting (Ch. 6)
Introduction to Discrete Probability Epp, section 6.x CS 202.
Counting Principles Multiplication rule Permutations Combinations.
Counting.
Chapter 7 – Counting Techniques CSNB 143 Discrete Mathematical Structures.
2/24/20161 One, two, three, we’re… Counting. 2/24/20162 Basic Counting Principles Counting problems are of the following kind: “How many different 8-letter.
Introduction Suppose that a password on a computer system consists of 6, 7, or 8 characters. Each of these characters must be a digit or a letter of the.
Section Basic Counting Principles: The Product Rule The Product Rule: A procedure can be broken down into a sequence of two tasks. There are n 1.
CS 104: Discrete Mathematics
Chapter 6 With Question/Answer Animations Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written.
ICS 253: Discrete Structures I Counting and Applications King Fahd University of Petroleum & Minerals Information & Computer Science Department.
Discrete Mathematics and Its Applications Sixth Edition By Kenneth Rosen Chapter 5 Counting 歐亞書局.
Section The Product Rule  Example: How many different license plates can be made if each plate contains a sequence of three uppercase English letters.
COUNTING Discrete Math Team KS MATEMATIKA DISKRIT (DISCRETE MATHEMATICS ) 1.
Lec 13 – March 10  The Basics of Counting  The Pigeonhole Principle  Permutations and Combinations  Binomial Coefficients and Identities  Generalized.
Counting Chapter 6.
ICS 253: Discrete Structures I
Chapter 5, Section 5.1 The Basics of Counting
The Pigeonhole Principle
Discrete Structures for Computer Science
COCS DISCRETE STRUCTURES
Counting Chapter 6 With Question/Answer Animations
Recursively Defined Functions
CS100: Discrete structures
Discrete Structures for Computer Science
Module #15: Combinatorics
Module #15: Combinatorics
Discrete Structures Counting.
Representations of Integers
Discrete Mathematics and its Applications
Chapter 3. Sets & Combinatorics
With Question/Answer Animations
Presentation transcript:

Chapter 5 5.1 The Basics of Counting 5.2 The Pigeonhole Principle 5.3 Permutations and Combinations 5.4 Binomial Coefficients 5.5 Generalized Permutations and Combinations 5.6 Generating Permutations and Combinations

Basic Counting Principles Product rule Sum rule

Basic Counting Principles THE SUM RULE: If task can be done either in one of n1 ways or in one of n2 ways, where none of the set of n1 ways is the same as any of the set of n2 ways, then there are n1+n2 ways to do the task. Example: Suppose statement labels in a programming language must be a single letter or a single decimal digit. How many possible labels? HW: Example 13,(p.339)

Basic Counting Principles THE PRODUCT RULE: Suppose that a procedure can be broken down into a sequence of two tasks. If there are n1 way to do the first task and for each of these ways of doing the first task, there are n2 ways to do the second task, then there are n1n2 ways to do the procedure. Example: Statement labels in Basic can be either a single letter or a letter followed by a digit. How many possible labels? HW: Example 3, (p.336)

Basic Counting Principles Example 7: Counting One-to-One functions : How many one-to-one functions are there from a set with m elements to one with n element? Example 12: A student can choose a computer project from one of three lists. The three lists contain 23, 15, and 19 possible projects, respectively. No project is on more than one list. How many possible projects are there to choose from? Example 9: what is the value of k after the following code has been executed? k := 0 for i1 := 1 to n1 for i2 := 1 to n2 : for im := 1 to nm k := k+1

More Complex Counting Problems Example 15: Each user on a computer system has a password, which is six to eight characters long, where each character is an uppercase letter or a digit. Each password must contain at least one digit. How many possible passwords are there?

More Complex Counting Problems Counting Integer Addresses In the internet, which is made up of interconnected physical networks of computers, each computer is assigned an Internet address. In Version 4 of the Internet Protocol( IPv4) , now in use, an address is string of 32bits. It beings with network number (netid). The netid is followed by a host number (hostid) , which identifies a computer as a member of a particular network.

More Complex Counting Problems Three forms of addresses are used, with different numbers of bits used for netid and hostid. Class A addresses, used for the largest networks, consist of 0, followed by a 7-bit netid and a 24-bit hostid. Class B addresses, used for medium-sized networks, consist of 10, followed by a 14-bit netid and a 16-bit hostid. Class C addresses, used for the smallest networks, consist of 110, followed by a 21-bit netid and an 8-bit hostid.

More Complex Counting Problems There are several restrictions on addresses because of special uses: 1111111 is not available as the netid of a Class A network, and the hostids consisting of all 0s and all 1s are not available for use in any network. How many different IPv4 addresses are available for computers on the internet?

The Principle of Inclusion Exclusion If A and B are NOT disjoint: |AB|=|A|+|B|-|AB| Don't count objects in the intersection of two sets more than once! Example : Find the number of three-letter initials where none of the letters is repeated. Example: Count the number of bit strings of length 4 which begin with a 1 or end with a 00. Example : Count the number of bit strings of length 4. (Apply the rule of product.) Example : Count the number of bit strings of length 4 or less. (Apply the rule of sum) Example : Count the set S of 3 digit numbers which begin or end with an even digit. HW: example 17,(p.342)

Tree Diagrams Counting problems can be solved using tree diagrams. Example 19: How many bit strings of length four do not have two consecutive 1s? FIGURE 2 Bit Strings of Length Four without Consecutive 1s.

Tree Diagrams Example 20: A playoff between two teams consists of at most five games. The first team that wins three games wins the playoff . In how many different ways can the playoff occur? FIGURE 3 Best Three Games Out of Five Playoffs.