CSE 321 Discrete Structures

Slides:



Advertisements
Similar presentations
Basic Permutations and Combinations
Advertisements

Lecture 4 4.1,4.2 Counting. 4.1 Counting Two Important Principles: Product Rule and Sum Rule. Product Rule: Assume we need to perform procedure 1 AND.
Counting. Counting = Determining the number of elements of a finite set.
Recursively Defined Functions
The Pigeonhole Principle
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.
after UCI ICS/Math 6A, Summer Counting-1 Counting: Product and Sum Rules Product Rule: Assuming a)We need to.
College of Information Technology & Design
Copyright © Zeph Grunschlag, Counting Techniques Zeph Grunschlag.
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
CSE 321 Discrete Structures Winter 2008 Lecture 12 Induction.
CSE 321 Discrete Structures Winter 2008 Lecture 16 Counting.
Combinations We should use permutation where order matters
Recursive Definitions Rosen, 3.4 Recursive (or inductive) Definitions Sometimes easier to define an object in terms of itself. This process is called.
CS100 : Discrete Structures
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.
CSE 311 Foundations of Computing I Lecture 15 Recursive Definitions and Structural Induction Autumn 2011 CSE 3111.
CSE 311 Foundations of Computing I Lecture 16 Recursively Defined Sets and Structural Induction Spring
Dr. Eng. Farag Elnagahy Office Phone: King ABDUL AZIZ University Faculty Of Computing and Information Technology CPCS 222.
1 Lecture 4 (part 1) Combinatorics Reading: Epp Chp 6.
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.
CSE 311 Foundations of Computing I Lecture 17 Structural Induction Spring
Counting Techniques. L172 Agenda Section 4.1: Counting Basics Sum Rule Product Rule Inclusion-Exclusion.
Counting.
Lecture 2 Overview Topics What I forgot from last lecture Proof techniques continued Alphabets, strings, languages Automata June 2, 2015 CSCE 355 Foundations.
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
CSE 311: Foundations of Computing Fall 2013 Lecture 18: Structural induction, regular expressions.
ICS 253: Discrete Structures I Counting and Applications King Fahd University of Petroleum & Minerals Information & Computer Science Department.
CSE 311 Foundations of Computing I Lecture 15 Strong Induction and Recursive Definitions Spring
Discrete Mathematics and Its Applications Sixth Edition By Kenneth Rosen Chapter 5 Counting 歐亞書局.
COUNTING Discrete Math Team KS MATEMATIKA DISKRIT (DISCRETE MATHEMATICS ) 1.
Discrete Mathematics Counting.
ICS 253: Discrete Structures I
Chapter 5, Section 5.1 The Basics of Counting
Copyright © Zeph Grunschlag,
The Pigeonhole Principle
COCS DISCRETE STRUCTURES
CSE 311 Foundations of Computing I
Copyright © Zeph Grunschlag,
Counting Chapter 6 With Question/Answer Animations
CS 2210 Discrete Structures Counting
Recursively Defined Functions
CS100: Discrete structures
Discrete Structures for Computer Science
CSE 311: Foundations of Computing
Math/CSE 1019: Discrete Mathematics for Computer Science Fall 2011
Counting Permutations When Indistinguishable Objects May Exist
CSE 311 Foundations of Computing I
Basic Counting.
CSE 321 Discrete Structures
CSE 321 Discrete Structures
CSE 321 Discrete Structures
Counting techniques Basic Counting Principles, Pigeonhole Principle, Permutations and Combinations.
CSE 321 Discrete Structures
Representations of Integers
CSE 321 Discrete Structures
Copyright © Zeph Grunschlag,
Copyright © Zeph Grunschlag,
CSE 321 Discrete Structures
CSE 321 Discrete Structures
CSE 311 Foundations of Computing I
CSE 311 Foundations of Computing I
CSCE 355 Foundations of Computation
Presentation transcript:

CSE 321 Discrete Structures Winter 2008 Lecture 16 Counting

Announcements Readings Friday, Wednesday: Counting 6th edition: 5.1, 5.2, 5.3, 5th edition: 4.1, 4.2. 4.3 Lecture 16 video will be posted on Tuesday Monday, Presidents’ Day, Holiday

Highlights from Lecture 15 Structural Induction Recursive Definition   L w  L, x  {a, b} then wxx  L Recursive Function len() = 0 w *, x  , len(wx) = 1 + len(w) Prove all words in L have even length

Counting Determining the number of elements of a finite set

Counting Rules Product Rule: If there are n1 choices for the first item and n2 choices for the second item, then there are n1n2 choices for the two items Sum Rule: If there are n1 choices of an element from S1 and n2 choices of an element from S2 and S1 S2 is empty, then there are n1 + n2 choices of an element from S1 S2

Counting examples License numbers have the form LLL DDD, how many different license numbers are available? There are 38 students in a class, and 38 chairs, how many different seating arrangements are there if everyone shows up? How many different predicates are there on  = {a,…,z}?

Important cases of the Product Rule Cartesian product |A1  A2  …  An| = |A1||A2|. . . |An| Subsets of a set S |P(S)|= 2|S| Strings of length n over  |n| = ||n

Counting Functions Suppose |S| = n, |T| = m How many functions from S to T? How many one-to-one functions from S to T?

More complicated counting examples BASIC variable names Variables can be one or two characters long The first character must be a letter The second character can be a letter or a digit The keywords “TO”, “IF”, and “DO” are excluded

Counting Passwords Passwords must be 4 to 6 characters long, and must contain at least one letter and at least one digit. (Case insensitive, no special characters)

Inclusion-Exclusion Principle |A1  A2 | = |A1| + |A2| - |A1  A2| How many binary strings of length 9 start with 00 or end with 11

Inclusion-Exclusion A class has of 40 students has 20 CS majors, 15 Math majors. 5 of these students are dual majors. How many students in the class are neither math, nor CS majors?

Generalizing Inclusion Exclusion

Pigeon Hole Principle If k is a positive integer and k+1 or more objects are placed into k boxes, then at least one box has two or more objects If N objects are placed into k boxes, then there is at least one box containing at least N/k objects

PHP Applications Prove that if a city has at least 10 million phone subscribers it needs more than one area code. (Phone numbers of the form NXX-XXXX.) Prove that if you have 800 people, at least three share a common birthday.

Clever PHP Applications Every sequence of n2 + 1 distinct numbers contains a subsequence of length n+1 that is either strictly increasing or strictly decreasing. 4, 22, 8, 15, 19, 11, 2, 1, 9, 20, 10, 7, 16, 3, 6, 5, 14

Proof Let a1, . . . am be a sequence of n2+1 distinct numbers Let ik be the length of the longest increasing sequence starting at ak Let dk be the length of the longest decreasing sequence starting at ak Suppose ik  n and dk  n for all k There must be k and j, k < j, with ik = ij and dk = dj