Presentation is loading. Please wait.

Presentation is loading. Please wait.

Spring 2016 COMP 2300 Discrete Structures for Computation Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University.

Similar presentations


Presentation on theme: "Spring 2016 COMP 2300 Discrete Structures for Computation Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University."— Presentation transcript:

1 Spring 2016 COMP 2300 Discrete Structures for Computation Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University 1 Chapter 9.1 Counting and Probability

2 Sample Space A sample space is the set of all possible outcomes of a random process or experiment. An event is a subset of a sample space. Example Tossing Two Coins Possible outcomes: FF, FT, TF, TT Sample space: {FF, FT, TF, TT} 2 Spring 2016 COMP 2300 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University

3 Equally Likely Probability Formula If S is a finite sample space in which all outcomes are equally likely and E is an event in S, then the probability of E, denoted P( E ), is For any finite set A, N ( A ) denotes the number of elements in A. 3 Spring 2016 COMP 2300 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University

4 Equally Likely Probability Formula – cont’ Example Tossing Two Coins What is P( E =“One head, one tail”)? 4 Spring 2016 COMP 2300 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University Coin 1Coin 2 TT TH HT HH

5 Rolling a Pair of Dice Suppose we are rolling a pair of dice. Use the compact notation to write the sample space S of possible outcomes. Use set notation to write the event E that the numbers showing face up have a sum of 6 and find the probability of this event. 5 Spring 2016 COMP 2300 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University

6 Rolling a Pair of Dice – cont’ Suppose we are rolling a pair of dice. Use the compact notation to write the sample space S of possible outcomes. Use set notation to write the event E that the numbers showing face up have a sum of 6 and find the probability of this event. 6 Spring 2016 COMP 2300 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University

7 Counting the Elements of a List Theorem 9.1.1 The Number of Elements in a List If m and n are integers and, then there are n-m +1 integers from m to n inclusive. Examples How many integers are there from m =5 through n= 12? 5 ( m +1-1), 6( m +2-1), 7( m +3-1), 8( m +4-1), 9( m +5-1), 10( m +6-1), 11( m +7-1), 12( m +8-1), where 8 = n - m +1. How many three digit integer (100~999) are divisible by 5? 100 101 102 103 104 105 106 107 108 109 110 … 994 995 996 997 998 999 199-20+1 = 180 7 Spring 2016 COMP 2300 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University

8 Application: Counting Elements of a One-Dimensional Array Analysis of many computer algorithms requires skill at counting the elements of a one-dimensional array. Let A [1], A [2], …, A [ n ] be a one-dimensional array, where n is a positive integer. 1)Suppose the array is cut at a middle value A [ m ] so that two subarrays are formed: A [1], A [2], …, A [ m ] and A [ m +1], A [ m +2], …, A [ n ]. How many elements does each subarray have? 2)What is the probability that a randomly chosen element of the array has an even subscript I.If n is even? II.If n is odd? 8 Spring 2016 COMP 2300 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University

9 Application: Counting Elements of a One-Dimensional Array Analysis of many computer algorithms requires skill at counting the elements of a one-dimensional array. Let A [1], A [2], …, A [ n ] be a one-dimensional array, where n is a positive integer. 1)Suppose the array is cut at a middle value A [ m ] so that two subarrays are formed: A [1], A [2], …, A [ m ] and A [ m +1], A [ m +2], …, A [ n ]. How many elements does each subarray have? : m -1+1 = m and n -( m +1)+1 = n - m 2)What is the probability that a randomly chosen element of the array has an even subscript I.If n is even? II.If n is odd? 9 Spring 2016 COMP 2300 Department of Mathematics and Physics Donghyun (David) Kim North Carolina Central University


Download ppt "Spring 2016 COMP 2300 Discrete Structures for Computation Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University."

Similar presentations


Ads by Google