12月3日旅游与酒店管理学院酒店Q0441.pptx
《12月3日旅游与酒店管理学院酒店Q0441.pptx》由会员分享,可在线阅读,更多相关《12月3日旅游与酒店管理学院酒店Q0441.pptx(30页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、Discrete Mathematics Chapter 5 Counting大葉大學大葉大學 資訊工程系資訊工程系 黃鈴玲黃鈴玲Ch5-2 A counting problem: (Example 15) Each user on a computer system has a password, which is six to eight characters long, where each characters is an uppercase letter or a digit. Each password must contain at least one digit. How ma
2、ny possible passwords are there? This section introducesa variety of other counting problemsthe basic techniques of counting.5.1 The Basics of countingCh5-3Basic counting principles The sum rule: If a first task can be done in n1 ways and a second task in n2 ways, and if these tasks cannot be done a
3、t the same time. then there are n1+n2 ways to do either task.Example 11 Suppose that either a member of faculty or a student is chosen as a representative to a university committee. How many different choices are there for this representative if there are 37 members of the faculty and 83 students?n1
4、n2n1 + n2 waysCh5-4Example 12 A student can choose a computer project from one of three lists. The three lists contain23, 15 and 19 possible projects respectively.How many possible projects are there to choose from?Sol: 23+15+19=57 projects. The product rule: Suppose that a procedure can be broken d
5、own into two tasks. If there are n1 ways to do thefirst task and n2 ways to do the second task after the first task has been done, then there aren1 n2 ways to do the procedure.n1n2n1 n2 waysCh5-5Example 2 The chair of an auditorium (大禮堂) is to be labeled with a letter and a positive integer not exce
6、eding 100. What is the largest number of chairs that can be labeled differently?Sol: 26 100 = 2600 ways to label chairs. letter xx1001Example 4 How many different bit strings are there of length seven?Sol:12 3 4 5 6 7 0,1 0,1 0,1 . . . . . . 0,1 27 種Ch5-6Example 5 How many different license plates (
7、車牌) are available if each plate contains a sequence of 3 letters followed by 3 digits ?Sol: 263103 letter digitExample 6 How many functions are there from a set with m elements to one with n elements?Sol: f(a1)=? 可以是b1 bn, 共n種 f(a2)=? 可以是b1 bn, 共n種 : f(am)=? 可以是b1 bn, 共n種 nma1a2amb1b2bnfCh5-7Example
8、 7 How many one-to-one functions are there from a set with m elements to one with n element? (m n)Sol: f(a1) = ? 可以是b1 bn, 共 n 種 f(a2) = ? 可以是b1 bn, 但不能= f(a1), 共 n-1 種 f(a3) = ? 可以是b1 bn, 但不能= f(a1), 也不能=f(a2), 共 n-2 種 : : f(am) = ? 不可=f(a1), f(a2), . , f(am-1), 故共n-(m-1)種 共 n(n-1)(n-2).(n-m+1)種 1-
9、1 function #Ch5-8Example 15 Each user on a computer system has a password which is 6 to 8 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?Sol: Pi : # of possible passwords of length i , i=6,
10、7,8 P6 = 366 - 266 P7 = 367 - 267 P8 = 368 - 268 P6 + P7 + P8 = 366 + 367 + 368 - 266 - 267 - 268種Ch5-9Example 14 In a version of Basic, the name of a variableis a string of one or two alphanumeric characters, whereuppercase and lowercase letters are not distinguished.Moreover, a variable name must
11、begin with a letter andmust be different from the five strings of two charactersthat are reserved for programming use. How many different variable names are there in this version of Basic?Sol: Let Vi be the number of variable names of length i. V1 =26 V2 =2636 5 26 + 2636 5 different names.Ch5-10 Th
12、e Inclusion-Exclusion Principle (排容原理排容原理) A BExample 17 How many bit strings of length eight either start with a 1 bit or end with the two bits 00 ?Sol: . . . . . . 1 0,1 0,1 共27種 . . . . . . . . . . . . 0 0 共26種 1 . . . . . . . . . . . 0 0 共25種 27 +26 -25 種BABABA-=Ch5-1101bit 1 Tree Diagrams Examp
13、le 18 How many bit strings of length four do not have two consecutive 1s ? Sol: Exercise: 11, 17, 23, 27, 38, 39, 47, 5300000111001(0000)(0001)(0010)(0100)(0101)(1000)(1001)(1010) 8 bit strings00110bit 3Ch5-12Ex 38. How many subsets of a set with 100 elements have more than one element ? Sol: Ex 39.
14、 A palindrome (迴文) is a string whose reversal is identical to the string. How many bit strings of length n are palindromes ? ( abcdcba 是迴文, abcd 不是 )Sol: If a1a2 . an is a palindrome, then a1=an, a2=an-1, a3=an-2, 1012 2100.9810099100100100 ) 1 (100-=Thm. 4 of 4.310021,., )2(aaa1012 ,., , :subset 10
15、0- 放不放 放不放 放不放空集合及只有1個元素的集合string.種22nCh5-13 5.2 The Pigeonhole Principle (鴿籠原理鴿籠原理)Theorem 1 (The Pigeonhole Principle) If k+1 or more objects are placed into k boxes, then there is at least one box containing two or more of the objects.Proof Suppose that none of the k boxes contains more than one
16、object. Then the total number of objects would be at most k. This is a contradiction.Example 1. Among any 367 people, there must be at least two with the same birthday, because there are only 366 possible birthdays.Ch5-14Example 2 In any group of 27 English words, there must be at least two that beg
17、in with the same letter.Example 3 How many students must be in a class to guarantee that at least two students receive the same score on the final exam ? (0100 points)Sol: 102. (101+1)Theorem 2. (The generalized pigeon hole principle) If N objects are placed into k boxes, then there is at least one
18、box containing at least objects.e.g. 21 objects, 10 boxes there must be one box containing at least objects.kN31021=Ch5-15Example 5 Among 100 people there are at least who were born in the same month. ( 100 objects, 12 boxes )912100=Ch5-16Example 10 During a month with 30 days a baseball team plays
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 12 旅游 酒店 管理学院 Q0441
限制150内