Вы находитесь на странице: 1из 2

COUNTING PRINCIPLES

Addition Principle
Suppose that T1, T2,, Tk are sets that contain n1, n2,, nk elements respectively.
If T1, T2,, Tk are pairwise disjoint sets, the number of possible elements that can be chosen from T1, T2,, Tk is n1 + n2 + + nk.

COUNTING PRINCIPLES
Multiplication Principle
Suppose two tasks T1 and T2 can be performed in sequence. If T1 can be performed in n1 ways and T2 can be performed in n2 ways,
then the sequence T1T2 can be performed in n1n2 ways.

Suppose there are k (T1, T2,, Tk ) tasks that can be performed in sequence (extending the situation described above),
then the sequence T1T2Tk can be performed in n1n2 nk ways.

COUNTING PRINCIPLES
Let A be a set with n elements
The number of sequences of length r that can be formed from the elements of A if elements of A can be repeated is:
(n)(n)(n) = nr
r-length sequence

COUNTING PRINCIPLES
Consider the following:
Let B = set of binary digits {0, 1}
How many 8-bit strings can be formed from B?

Let L = {a, b, c, d, e, f}
How many strings of length 10 can be formed? How many strings of length 4 can be formed? How many strings of length 6 can be formed if repeated letters are not allowed?

6 men and 4 women are waiting in line.


How many arrangements are possible? In how many ways can the line be arranged if all men and all women stand together?

COUNTING PRINCIPLES
Let A be a set with n elements.
The number of sequences that can be formed from the elements of A if all elements in the sequence must be distinct is referred to as the permutation of n.
The number of permutations of n objects is n (n-1)(n-2)(1) = n! The number of permutations of n taken r at a time (i.e., the number of sequences of length r) is P(n, r) = n (n-1) (n-2)(n-r+1) = n!/(n-r)!

COUNTING PRINCIPLES
Permutations (continued)
The number of permutations of n objects arranged in a circle is (n-1)! The number of distinguishable permutations that can be formed from a collection of n objects, where the first object appears k1 times, the second object k2 times, and so on, is: n!/(k1! k2!... kt!)

COUNTING PRINCIPLES
Consider the following:
How many eight-bit strings contain exactly four 1s? Given a deck of 52 playing cards:
How many 5-card hands can be dealt from the deck? How many 5-card hands contain only spades? How many 5-card hands are of the same suit? How many 5-card hands contain 4 aces?

COUNTING PRINCIPLES
Let A be a set with n elements
The number of r-element subsets of A is referred to as the number of combinations of A, taken r at a time
C(n, r) = n! / r!(n-r)!

Given a shipment of 50 microprocessors of which 4 are defective, in how many ways can a set of 4 microprocessors be selected such that there is at least 1 defective microprocessor?

In general, when order matters, count the number of sequences or permutations, When order does not matter, count the number of subsets or combinations.

EXERCISES
How many eight-bit strings start with 111? In a programming language, valid identifiers consist of one to six alphanumeric characters beginning with letters. A six-person committee composed of Phoebe, Monica, Rachel, Joey, Ross and Chandler is to select a chairperson, secretary and treasurer. In how many ways can this be done? In how many ways can this be done if either Phoebe or Joey must be chairperson? In how many ways can this be done Monica must hold one of the offices? In how many ways can this be done if both Chandler and Ross must hold one of the offices?

EXERCISES
In how many ways can two books be selected from different subjects among five distinct computer science books, three distinct mathematics books, and two distinct art books? How many permutations of the letters ABCDEF contain the substring DEF? How many words of three distinct letters can be formed from the letters of the word MAST? How many different seven-person committees can be formed such that each contains three women from an available set of 20 women and four men from an available set of 30 men. How many thirteen-card hands contain all four aces? How many thirteen-card hands contain four hands of three suits and one card of the fourth suit?

Вам также может понравиться