07counting10_modified

07counting10_modified - ENGG1007 Foundations of Computer...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
1 ENGG1007 Foundations of Computer Science Counting Counting Prof. Francis Chin, Dr SM Yiu October 4 / 6, 2010 (Chapter 5)
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
2 ENGG1007 FCS Counting Counting Counting Counting is for finding the number of possible arrangements or configurations of a certain pattern. Examples: Assume the length of a password is between 6 and 8,? how secure is this password system? E.g., year2010, computer, ebi8ks9, …. How many possible passwords are there if each character must be in {0,1,…,9} or {a, b,…, z}? The larger is this number, the more secure is the system. Is a 5-card poker hand with a “pair of 6” a good hand? How many different hands and players are there? How many hands are there without a “pair”?
Background image of page 2
3 ENGG1007 FCS Basic Counting Rules – The Sum Rule Basic Counting Rules – The Sum Rule How many ways I can get a red card from a deck of cards? Answer: 13 +13 = 26 (either heart or diamond) Three departments offer 23, 15, and 19 courses, respectively. A student can choose an elective course from these departments. How many possible courses he can choose? Answer: 23 + 15 + 19 = 57 The Sum Rule The Sum Rule : Suppose r tasks T 1 , T 2 , …, T r can be done in n 1 , n 2 , …, n r ways, respectively. Then, there are n 1 + n 2 + … + n r ways for doing any of the r tasks. Note that all these tasks are “exclusive”, i.e., only one can be done.
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
4 ENGG1007 FCS Basic Counting Rules – The Sum Rule Basic Counting Rules – The Sum Rule The Sum Rule The Sum Rule : r tasks T 1 , T 2 , …, T r can be done in n 1 , n 2 , …, n r ways respectively. There are n 1 + n 2 + … + n r ways for doing any of the r tasks. Another example: There are 5 tours to Japan, 3 tours to Taiwan, 2 tours to India, and 3 tours to Singapore. I plan to take one of these tours. There are 4 tasks: T 1 (Japan) which can be done n 1 = 5 ways, T 2 (Taiwan) with n 2 = 3 , T 3 (India) with n 3 = 2 and T 4 (Singapore) with n 4 = 3. There are 5+3+2+3 = 13 ways for doing any of the tasks (or 13 tours I can choose from).
Background image of page 4
5 ENGG1007 FCS The Product Rule The Product Rule There are 8 ways to get to Central from HKU: bus 23, 91, 4, 7, 37. 90B, 40 and minibus; and 2 ways from Central to Tsimshatsui,: MTR and ferry. How many ways are there from HKU to Tsimshatsui? Answer: 8 × 2 = 16 ways How many 5-character passwords are there if each password must start with 2 letters followed by 3 digits? Answer: 26
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

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

{[ snackBarMessage ]}

Page1 / 19

07counting10_modified - ENGG1007 Foundations of Computer...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online