Generalized Permutations and Combinations Generating Permutations and Combinations - PowerPoint PPT Presentation

1 / 21
About This Presentation
Title:

Generalized Permutations and Combinations Generating Permutations and Combinations

Description:

... shop has plain croissants, cherry croissants, chocolate croissants, almond ... with at least one plain, two cherry three chocolate, one almond, two apple and ... – PowerPoint PPT presentation

Number of Views:1226
Avg rating:3.0/5.0
Slides: 22
Provided by: isabellebi
Category:

less

Transcript and Presenter's Notes

Title: Generalized Permutations and Combinations Generating Permutations and Combinations


1
Generalized Permutations and CombinationsGenerat
ing Permutations and Combinations
2
Learning Objectives
  • How to count permutations with repetition and
    combinations with repetition ?
  • How to generate permutations and combinations ?

3
Perm/Comb with Repetition
  • Permutations with repetitions
  • The number of r permutations with repetitions
    from a set with n elements is nr (The product
    rule).
  • Combinations with repetitions
  • The number of r combinations with repetitions
    from a set with n elements is C(n r 1,r)

4
Perm/Comb with Repetition
  • Proof
  • Let A a1, , an. Consider the following bar
    code
  • . . . We have exactly n 1 bars.
    These bars generate n holes. Place in hole
    number k, m stars to indicate that in the
    selection represented by this bar code you are
    going to pick m copies of ak. So the total number
    of symbols is going to be n 1 r and the
    number of r combinations with repetitions will
    thus be n 1 r choose r C(n r 1,n - 1)
    C(n r - 1, r)

5
Perm/Comb with Repetition
  • Comparison of counting methods for groups of
    objects

6
Perm. Indistinguishable Objects
  • Permutations with indistinguishable objectsThe
    number of permutations of n objects, where there
    are n1 indistinguishable objects of type 1, n2
    indistinguishable objects of type 2, and nk
    indistinguishable objects of type k are

7
Perm. Indistinguishable Objects
  • Proof place n objects
  • n1 same objects can be placed in C(n, n1) ways
    (corresponds to choosing the positions among n)
  • n2 same objects can be placed in C(n- n1, n2)
    ways
  • nk same objects can be placed in C(n- n1- -
    nk-1, nk) ways
  • product rule C(n, n1) C(n- n1, n2) C(n- n1-
    - nk-1, nk) n! / n1! n2! nk!

8
Perm. Indistinguishable Objects
  • ExampleHow many strings can be made up with
    all letters of the word EVERGREEN9! / 4! 1! 2!
    1! 1!

9
Distributing Objects in Boxes
  • Distributing n distinguishable objects into k
    different boxesni objects are placed in box i,
    i1, , k

10
Distributing Objects in Boxes
  • Proof
  • n1 objects can be placed in box 1 in C(n, n1)
    ways (corresponds to choosing n1 objects among
    n)
  • n2 objects can be placed in box 2 in C(n- n1, n2)
    ways
  • nk objects can be placed in box k in C(n- n1- -
    nk-1, nk) ways
  • product rule C(n, n1) C(n- n1, n2) C(n- n1-
    - nk-1, nk) n! / n1! n2! nk!

11
Distributing Objects in Boxes
  • ExampleHow many ways are there to distribute
    hands of 5 cards to four players from a standard
    deck of 52 cards ?52! / 5! 5! 5! 5! 32!

12
Generating Permutations
  • Lexicographic order (dictionary order)a1a2an
    precedes b1b2bn if, for some k, with 1 ? k ? n,
    a1 b1, a2 b2, a k-1 b k-1, and ak lt bk.
  • Next permutation find k such that ak lt a
    k1and a k1 gt a k2 gt... gt a n

13
Generating Permutations
  • Examplepermutations of the set 1,2,3,4,5
    23415 precedes the permutation 23451
  • Example 362541 --gt 364125

14
Generating Permutations
  • Algorithm principle a1a2an
  • find the largest j such that aj lt aj1 and ? k
    gt j ak gt ak1
  • put in jth position the least element in aj1an
    that is larger than aj (exchange with aj).
  • arrange the elements after j in increasing order.
  • Example 362541
  • first pair from the right such that aj lt aj1 is
    (2,5)
  • exchange 2 and 4
  • reorder the other elements in increasing order
  • result 364125

15
Generating Permutations
  • Example 45231
  • first pair from the right such that aj lt aj1 is
    (2,3)
  • exchange 2 and 3
  • reorder the other elements in increasing order
  • result 45312

16
Generating Combinations
  • A combination is a subset of a set of elements
    a1, a2, , an
  • A combination can be represented as a bit string,
    where each bit represents an element in the set,
    and has the value 1 if the element is in the
    subset, and 0 if not.
  • Example set of elements a, b, c, d, e, f
    subset a, b, f is represented by the bit
    string 110001, b, d is represented by the bit
    string 010100.

17
Generating Combinations
  • Finding the next combination is done by
    generating the next bit string (add 1 to the
    current bit string).Find the first 0 from the
    right, change it to a 1 and change all 1s to its
    right to 0s.
  • Example 1000100the next combination will be
    1000101
  • Example 101111the next combination will be
    110000

18
Examples
  • A croissant shop has plain croissants, cherry
    croissants, chocolate croissants, almond
    croissants, apple croissants and broccoli
    croissants. How many ways are there to choose
  • a) a dozen croissants
  • we suppose that there are at least 12 of each
    kind of croissants. C(6 12 - 1, 12) C(17,
    12)17! / 12! 5!
  • plaincherrychocolatealmondapplebroccoli
  • place 12 croissants in these boxes (5 bars and
    12 stars).
  • There are 12 6 - 1 objects to choose from, and
    12 to choose from these.

19
Examples
  • b) three dozen croissants
  • we suppose that there are at least 36 of each
    kind of croissants. C(36 6 - 1, 36) C(41,
    36)41! / 36! 5!
  • plaincherrychocolatealmondapplebroccoli
  • place 36 croissants in these boxes (5 bars and
    36 stars).
  • There are 36 6 - 1 objects to choose from, and
    36 to choose from these.

20
Examples
  • c) two dozen croissants with at least two of
    each kind2 . 6 croissants are already attributed
    to their kind. There remains 12 croissants to
    choose from the 6 categories.
  • C(12 6 - 1, 12) C(17, 12) 17! / 12! 5!
  • d) two dozen croissants with no more than 2
    broccoli croissants
  • 0 broccoli C(24 5 - 1, 24)
  • 1 broccoli C(23 5 - 1, 23)
  • 2 broccoli C(22 5 - 1, 22)
  • total C(28, 24) C(27, 23) C(26, 22)

21
Examples
  • e) two dozen croissants with at least five
    chocolate croissants and at least three almond
    croissantsC(16 6 - 1, 16) C(21, 16) 21! /
    16! 5!
  • f) two dozen croissants with at least one plain,
    two cherry three chocolate, one almond, two apple
    and no more than three broccoli 9 are already
    attributed.
  • 0 broccoli C(15 5 - 1, 15)
  • 1 broccoli C(14 5 - 1, 14)
  • 2 broccoli C(13 5 - 1, 13)
  • 3 broccoli C(12 5 - 1, 12)
  • total C(19, 15) C(18, 14) C(17, 13) C(16,
    12)
Write a Comment
User Comments (0)
About PowerShow.com