# L05-1 - Counting Counting in Algorithms How many...

This preview shows pages 1–8. Sign up to view the full content.

Counting

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

View Full Document
Counting in Algorithms How many comparisons are needed to sort n numbers? How many steps to compute the GCD of two numbers ? How many steps to factor an integer?
How many different configurations for a Rubik’s cube? How many weighings to nd the one counterfeit among 12 coins? How many different chess positions after n moves? Counting in Games

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

View Full Document
If sets A and B are disjoint , then | A B | = | | + | | Sum Rule Class has 43 women, 54 men, so total enrollment = 43 + 54 = 97 26 lower case letters, 26 upper case letters, and 10 digits, so total characters = 26+26+10 = 62
Given two sets A and B, the Cartisean product Product Rule If | A | = m and | B | = n, then | | = mn. = { a, b, c, d }, B = { 1, 2, 3 } B = {( a , 1 ),( a , 2 ),( a , 3 ), ( b , 1 ),( b ,2 ),( b , 3 ), ( c , 1 ),( c , 2 ),( c , 3 ), ( d , 1 ),( d , 2 ),( d , 3 )} If there are 4 men and 3 women, there are possible married couples. 4 1 3 2

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

View Full Document
Product Rule: Counting Strings The number of length-4 strings from alphabet B ::= { 0 , 1 } = | | = ±2 ± ·2 ± ± ±= 4 The number of length- n stringsfrom an alphabet of size m is .
between 6 & 8 characters long starts with a letter case sensitive other characters: digits or letters How many passwords satisfy the following requirements?

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 35

L05-1 - Counting Counting in Algorithms How many...

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

View Full Document
Ask a homework question - tutors are online