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
ENGG1007 oundations of Computer Science Foundations of Computer Science Counting Prof. Francis Chin, Dr SM Yiu October 4 / 6, 2010 (Chapter 5) 1
Background image of page 1

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

View Full DocumentRight Arrow Icon
ENGG1007 FCS ounting Counting Counting is for finding the number of possible arrangements r configurations of a certain pattern or configurations of a certain pattern. xamples 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? ow many different hands nd players are ere? 2 ) How many different hands and players are there? ) How many hands are there without a “pair”?
Background image of page 2
ENGG1007 FCS asic Counting Rules he 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 he um Rule The The Sum Rule Sum Rule : ¾ Suppose r tasks T 1 , T 2 , …, T r can be done in n , n , …, n ways, respectively. 1 2 r ¾ Then, there are n 1 + n 2 + … + n r ways for doing any of the r tasks. 3 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 DocumentRight Arrow Icon
ENGG1007 FCS asic Counting Rules he Sum Rule Basic Counting Rules The Sum Rule The The Sum Rule Sum Rule : k bd i ti l ¾ 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 urs can choose om). 4 tours I can choose from).
Background image of page 4
ENGG1007 FCS he Product Rule The Product Rule There are 8 ways to get to Central from HKU: us 23 91 4 7 37 90B 40 and minibus; 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? nswer: 8 = 16 ways Answer: 8 × 2 16 ways How many 5-character passwords are there if each assword must start with 2 letters followed by 3 digits? password must start with 2 letters followed by 3 digits? ¾ Answer: 26 × 26 × 10 × 10 × 10 = 676000 he Product Rule The Product Rule : ¾ Suppose a sequence of r tasks T 1 , T 2 , …, T r such that each task T i can be done in n i ways ( i= 1,2,…, r ), and at each tasks are dependent each other.
Background image of page 5

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

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

This note was uploaded on 02/10/2011 for the course ENGG 1007 taught by Professor Unknown during the Spring '11 term at HKU.

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