Will Monroe June 28, with materials by Mehran Sahami and Chris Piech. Combinatorics

Size: px
Start display at page:

Download "Will Monroe June 28, with materials by Mehran Sahami and Chris Piech. Combinatorics"

Transcription

1 Will Monroe June 28, 27 with materials by Mehran Sahami and Chris Piech Combinatorics

2 Review: Course website

3 Logistics: Problem Set 4 questions (#: tell me about yourself!) Due: Wednesday, July 5 (before class) Handwrite and scan Word / Google Doc /... LaTeX (see website for getting started!) EmojiOne

4 Logistics: Office hours For SCPD: Thursday afternoon also online (Hangouts)!

5 Logistics: Textbook (or not) Sheldon Ross A First Course in Probability 9th (or 8th) Edition Optional! Has lots of helpful examples. Suggested readings on website. Go up two floors for copies on reserve (Terman Engineering Library)

6 Review: Principle of Inclusion/Exclusion The total number of elements in two sets is the sum of the number of elements of each set, minus the number of elements in both sets. A B = A + B A B = 6

7 Review: General principle of counting An experiment consisting of two or more separate parts has a number of outcomes equal to the product of the number of outcomes of each part. A A 2 A n = A i shapes: 4 colors: 3 i total: 4 3 = 2

8 Permutations The number of ways of ordering n distinguishable objects. n n! = n= i i=

9 Example: Servicing computers 9 computers to be scheduled for maintenance. How many possible orders?

10 Example: Servicing computers 9 computers to be scheduled for maintenance. How many possible orders? Pick the first: 9 choices

11 Example: Servicing computers 9 computers to be scheduled for maintenance. How many possible orders? 9 Pick the second: 8 choices

12 Example: Servicing computers 9 computers to be scheduled for maintenance. How many possible orders? 9 8 Pick the third: 7 choices

13 Example: Servicing computers 9 computers to be scheduled for maintenance. How many possible orders?

14 Example: Servicing computers 9 computers to be scheduled for maintenance. How many possible orders? = 362,88 9! 2

15 Example: Servicing computers 4 laptops, 3 tablets, 2 desktops. Same type have to be serviced together. How many possible orders?

16 Example: Servicing computers 4 laptops, 3 tablets, 2 desktops. Same type have to be serviced together. How many possible orders?

17 Example: Servicing computers 4 laptops, 3 tablets, 2 desktops. Same type have to be serviced together. How many possible orders? 4!

18 Example: Servicing computers 4 laptops, 3 tablets, 2 desktops. Same type have to be serviced together. How many possible orders? 4! 3!

19 Example: Servicing computers 4 laptops, 3 tablets, 2 desktops. Same type have to be serviced together. How many possible orders? 4! 3! 2!

20 Example: Servicing computers 4 laptops, 3 tablets, 2 desktops. Same type have to be serviced together. How many possible orders? 4! 3! 4! 3! 2! = 288 2!

21 Example: Servicing computers 4 laptops, 3 tablets, 2 desktops. Same type have to be serviced together. How many possible orders? 3! 4! 3! 4! 3! 2! 3! =,728 2!

22 Review: Binary search trees binary: Every node has at most two children

23 Review: Binary search trees binary: Every node has at most two children. search: Root value is - greater than values in the left subtree - less than values in the right subtree

24 Degenerate binary search trees degenerate: Every node has at most one child

25 Degenerate binary search trees degenerate: Every node has at most one child. 3 2 How many different BSTs containing the values, 2, and 3 are degenerate?

26 Degenerate binary search trees BSTs can be listed by order of insertion. How many possible orders for inserting, 2, and 3?

27 Degenerate binary search trees BSTs can be listed by order of insertion. How many possible orders for inserting, 2, and 3? 3! = 6, 2, 3, 3, 2 2,, 3 2, 3, 3,, 2 3, 2,

28 Degenerate binary search trees BSTs can be listed by order of insertion. How many possible orders for inserting, 2, and 3? 3! = 6, 2, 3, 3, 2 2,, 3 2, 3, 3,, 2 3, 2,

29 Degenerate binary search trees BSTs can be listed by order of insertion. How many possible orders for inserting, 2, and 3? 3! = 6, 2, 3 2, 3, 2 2,, 3 2, 3, 3,, 2 3, 2,

30 Degenerate binary search trees BSTs can be listed by order of insertion. How many possible orders for inserting, 2, and 3? 3! = 6, 2, 3, 3, ,, 3 2, 3, 3,, 2 3, 2,

31 Degenerate binary search trees BSTs can be listed by order of insertion. How many possible orders for inserting, 2, and 3? 3! = 6, 2, 3, 3, ,, 3 2, 3, 3,, 2 3, 2,

32 Degenerate binary search trees BSTs can be listed by order of insertion. How many possible orders for inserting, 2, and 3? 3! = 6, 2, 3, 3, ,, 3 2, 3, 3,, 2 3, 2,

33 Degenerate binary search trees BSTs can be listed by order of insertion. How many possible orders for inserting, 2, and 3? 3! = 6, 2, 3, 3, ,, 3 2, 3, 3,, 2 3, 2,

34 Degenerate binary search trees BSTs can be listed by order of insertion. How many possible orders for inserting, 2, and 3? 3! = 6, 2, 3, 3, ,, 3 2, 3, ,, 2 3, 2,

35 Degenerate binary search trees BSTs can be listed by order of insertion. How many possible orders for inserting, 2, and 3? 3! = 6, 2, 3, 3, ,, 3 2, 3, ,, 2 3, 2, degenerate BSTs 3

36 Permutations The number of ways of ordering n distinguishable objects. n n! = n= i i=

37 Permutations with indistinct elements The number of ways of ordering n. objects, where some groups are indistinguishable. ( n k, k 2,, k m ) n! = k! k 2! k m! k2 identical n k identical

38 Return of the binary strings How many distinct bit strings are there consisting of three 's and two 's?

39 Return of the binary strings How many distinct bit strings are there consisting of three 's and two 's? 5! = 2?

40 Return of the binary strings How many distinct bit strings are there consisting of three 's and two 's? 5! = 2

41 Return of the binary strings How many distinct bit strings are there consisting of three 's and two 's? 5! =

42 Return of the binary strings How many distinct bit strings are there consisting of three 's and two 's? 5! =

43 Return of the binary strings How many distinct bit strings are there consisting of three 's and two 's? 5! =

44 Return of the binary strings How many distinct bit strings are there consisting of three 's and two 's? 5! =

45 Return of the binary strings How many distinct bit strings are there consisting of three 's and two 's? 2! 5! =

46 Return of the binary strings How many distinct bit strings are there consisting of three 's and two 's? 2! 5! = 3!

47 Return of the binary strings How many distinct bit strings are there consisting of three 's and two 's? 2! 5! = 3! x

48 Return of the binary strings How many distinct bit strings are there consisting of three 's and two 's? 2! 5! = 3! x 5!=2! 3! x

49 Return of the binary strings How many distinct bit strings are there consisting of three 's and two 's? 2! = 3! x 5! 5! x= 2! 3!

50 Example: Servicing computers 4 laptops, 3 tablets, 2 desktops. Same type are indistinguishable. How many possible orders?

51 Example: Servicing computers 4 laptops, 3 tablets, 2 desktops. Same type are indistinguishable. How many possible orders? 9!

52 Example: Servicing computers 4 laptops, 3 tablets, 2 desktops. Same type are indistinguishable. How many possible orders? 4! 9!

53 Example: Servicing computers 4 laptops, 3 tablets, 2 desktops. Same type are indistinguishable. How many possible orders? 3! 4! 9!

54 Example: Servicing computers 4 laptops, 3 tablets, 2 desktops. Same type are indistinguishable. How many possible orders? 3! 4! 9! 2!

55 Example: Servicing computers 4 laptops, 3 tablets, 2 desktops. Same type are indistinguishable. How many possible orders? 3! 4! 9! 9! 9 = =,26 4,3,2 4! 3! 2! ( ) 2!

56 Example: Servicing computers 4 laptops, 3 tablets, 2 desktops. Same type are indistinguishable. How many possible orders? 3! 4! 9! 9 = 9! =,26 4,3,2 4! 3! 2! ( ) 2!

57 Example: Passcode guessing 4-digit passcode on a phone. How many possible codes? ABC DEF 5 6 GHI JKL MNO PQRS TUV WXYZ Room: CS9SUMMER7

58 Example: Passcode guessing 4-digit passcode on a phone. How many possible codes? ABC DEF 5 6 GHI JKL MNO PQRS TUV 4 =, WXYZ Room: CS9SUMMER7

59 Example: Passcode guessing 4 smudges on phone for a 4-digit passcode. How many possible codes? ABC DEF 5 6 GHI JKL MNO PQRS TUV WXYZ Room: CS9SUMMER7

60 Example: Passcode guessing 4 smudges on phone for a 4-digit passcode. How many possible codes? ABC DEF 5 6 GHI JKL MNO PQRS TUV 4!=24 WXYZ Room: CS9SUMMER7

61 Example: Passcode guessing 3 smudges on phone for a 4-digit passcode. How many possible codes? ABC DEF 5 6 GHI JKL MNO PQRS TUV WXYZ Room: CS9SUMMER7

62 Example: Passcode guessing 3 smudges on phone for a 4-digit passcode. How many possible codes? ABC DEF smudges = (less, same, more) possibilities vs. 4 smudges? A) less B) same C) more GHI JKL MNO PQRS TUV WXYZ Room: CS9SUMMER7

63 Example: Passcode guessing 3 smudges on phone for a 4-digit passcode. How many possible codes? ABC DEF 5 6 GHI JKL MNO PQRS TUV WXYZ 4! 3 =2 2!!!

64 Example: Passcode guessing 3 smudges on phone for a 4-digit passcode. How many possible codes? ABC DEF 5 6 GHI JKL MNO PQRS TUV WXYZ 4! 3 =36 2!!!

65 Example: Passcode guessing 2 smudges on phone for a 4-digit passcode. How many possible codes? ABC DEF 5 6 GHI JKL MNO PQRS TUV WXYZ

66 Example: Passcode guessing 2 smudges on phone for a 4-digit passcode. How many possible codes? ABC DEF 5 6 GHI JKL MNO PQRS TUV WXYZ Two and two Three and one

67 Example: Passcode guessing 2 smudges on phone for a 4-digit passcode. How many possible codes? ABC DEF 5 6 4! =6 2! 2! Three and one GHI JKL MNO PQRS Two and two TUV WXYZ

68 Example: Passcode guessing 2 smudges on phone for a 4-digit passcode. How many possible codes? ABC DEF 5 6 4! =6 2! 2! Three and one GHI JKL MNO PQRS Two and two TUV WXYZ 2 4! =8 3!!

69 Example: Passcode guessing 2 smudges on phone for a 4-digit passcode. How many possible codes? ABC DEF 5 6 GHI JKL MNO PQRS TUV WXYZ Two and two 4! =6 2! 2! + Three and one 2 4! =8 3!! =4

70 Permutations with indistinct elements The number of ways of ordering n. objects, where some groups are indistinguishable. ( n k, k 2,, k m ) n! = k! k 2! k m! k2 identical n k identical

71 Break time!

72 Combinations The number of unique subsets of size k from a larger set of size n. (objects are distinguishable, unordered) n k () n! = k!(n k )! choose k n

73 Picking drink flavors 5 drink flavors. How many ways to pick 3?

74 Picking drink flavors 5 drink flavors. How many ways to pick 3? 5! 5 = 5! = 2 2!3! ()

75 Picking drink flavors 5 drink flavors. How many ways to pick 3? 5! 3! 2! 5! = 5 3! 2! 3,2 ( )

76 Return of the binary strings How many distinct bit strings are there consisting of three 's and two 's? 2! = 3! x 5! 5! x= = 5 2! 3! 2,3 ( )

77 Return of the binary strings How many distinct bit strings are there consisting of three 's and two 's? = How many subsets of positions in a five-bit string are possible for placing two 's? 5! x= = 5 2! 3! 2,3 ( )

78 Return of the binary strings How many distinct bit strings are there consisting of three 's and two 's? = How many subsets of positions in a five-bit string are possible for placing two 's? 5! 5 5 x= = = 2! 3! 2,3 2 ( ) ()

79 Return of the binary strings How many distinct bit strings are there consisting of three 's and two 's? = How many subsets of positions in a five-bit string are possible for placing three 's? 5! 5 5 x= = = 3! 2! 3,2 3 ( )()

80 Return of the binary strings How many distinct bit strings are there consisting of three 's and two 's? = How many subsets of positions in a five-bit string are possible for placing three 's? 5! x= = = = 3! 2! 3,2 3 2 ( ) () ()

81 Binomial coefficient n k () n! = k!(n k )! choose k n

82 Combinations The number of unique subsets of size k from a larger set of size n. (objects are distinguishable, unordered) n k () n! = k!(n k )! choose k n

83 Bucketing The number of ways of assigning n distinguishable objects to a fixed set of k buckets or labels. k n n objects k buckets

84 String hashing m = 5 strings pacific cooler n = 3 buckets wild cherry mountain cooler sugar not sugar

85 String hashing m = 5 strings pacific cooler n = 3 buckets wild cherry 3 mountain cooler 3 3 sugar 3 not sugar 3 =3 5

86 Divider method The number of ways of assigning n indistinguishable objects to a fixed set of k buckets or labels. ( n+(k ) n ) n objects k buckets (k - dividers)

87 Indistinguishable drinks?

88 Indistinguishable drinks?

89 Indistinguishable drinks?

90 Indistinguishable drinks?

91 Indistinguishable drinks?

92 Indistinguishable drinks? 5 drinks 3 students 3 = 2 dividers

93 Indistinguishable drinks? 7 objects

94 Indistinguishable drinks? 5 drinks 7 objects

95 Indistinguishable drinks? 5 drinks 7 objects

96 Indistinguishable drinks? 5 drinks 7 objects

97 Indistinguishable drinks? 5 drinks 7 = 5+(3 ) =2 5 5 ()( ) 7 objects

98 Investing in startups million dollar bill image: Simon Davison

99 Investing in startups million dollar bill image: Simon Davison

100 Investing in startups million dollar bill image: Simon Davison

101 Investing in startups million dollar bill image: Simon Davison

102 Investing in startups million dollar bill image: Simon Davison

103 Investing in startups ( +3 =286 ) million dollar bill image: Simon Davison

104 Permutations The number of ways of ordering n distinguishable objects. n n! = n= i i=

105 Permutations with indistinct elements The number of ways of ordering n. objects, where some groups are indistinguishable. ( n k, k 2,, k m ) n! = k! k 2! k m! k2 identical n k identical

106 Combinations The number of unique subsets of size k from a larger set of size n. (objects are distinguishable, unordered) n k () n! = k!(n k )! choose k n

107 Bucketing The number of ways of assigning n distinguishable objects to a fixed set of k buckets or labels. k n n objects k buckets

108 Divider method The number of ways of assigning n indistinguishable objects to a fixed set of k buckets or labels. ( n+(k ) n ) n objects k buckets (k - dividers)

Permutations. Example 1. Lecture Notes #2 June 28, Will Monroe CS 109 Combinatorics

Permutations. Example 1. Lecture Notes #2 June 28, Will Monroe CS 109 Combinatorics Will Monroe CS 09 Combinatorics Lecture Notes # June 8, 07 Handout by Chris Piech, with examples by Mehran Sahami As we mentioned last class, the principles of counting are core to probability. Counting

More information

1 Permutations. Example 1. Lecture #2 Sept 26, Chris Piech CS 109 Combinatorics

1 Permutations. Example 1. Lecture #2 Sept 26, Chris Piech CS 109 Combinatorics Chris Piech CS 09 Combinatorics Lecture # Sept 6, 08 Based on a handout by Mehran Sahami As we mentioned last class, the principles of counting are core to probability. Counting is like the foundation

More information

1 Permutations. 1.1 Example 1. Lisa Yan CS 109 Combinatorics. Lecture Notes #2 June 27, 2018

1 Permutations. 1.1 Example 1. Lisa Yan CS 109 Combinatorics. Lecture Notes #2 June 27, 2018 Lisa Yan CS 09 Combinatorics Lecture Notes # June 7, 08 Handout by Chris Piech, with examples by Mehran Sahami As we mentioned last class, the principles of counting are core to probability. Counting is

More information

Probability. Will Monroe Summer 2017 with materials by Mehran Sahami and Chris Piech

Probability. Will Monroe Summer 2017 with materials by Mehran Sahami and Chris Piech Probability Will Monroe Summer 207 with materials by Mehran Sahami and Chris Piech June 30, 207 Today we will make history Logistics: Office hours Review: Permutations The number of ways of ordering n

More information

The Product Rule The Product Rule: A procedure can be broken down into a sequence of two tasks. There are n ways to do the first task and n

The Product Rule The Product Rule: A procedure can be broken down into a sequence of two tasks. There are n ways to do the first task and n Chapter 5 Chapter Summary 5.1 The Basics of Counting 5.2 The Pigeonhole Principle 5.3 Permutations and Combinations 5.5 Generalized Permutations and Combinations Section 5.1 The Product Rule The Product

More information

1. Counting. 2. Tree 3. Rules of Counting 4. Sample with/without replacement where order does/doesn t matter.

1. Counting. 2. Tree 3. Rules of Counting 4. Sample with/without replacement where order does/doesn t matter. Lecture 4 Outline: basics What s to come? Probability A bag contains: What is the chance that a ball taken from the bag is blue? Count blue Count total Divide Today: Counting! Later: Probability Professor

More information

Lecture 14. What s to come? Probability. A bag contains:

Lecture 14. What s to come? Probability. A bag contains: Lecture 14 What s to come? Probability. A bag contains: What is the chance that a ball taken from the bag is blue? Count blue. Count total. Divide. Today: Counting! Later: Probability. Professor Walrand.

More information

Discrete Mathematics: Logic. Discrete Mathematics: Lecture 15: Counting

Discrete Mathematics: Logic. Discrete Mathematics: Lecture 15: Counting Discrete Mathematics: Logic Discrete Mathematics: Lecture 15: Counting counting combinatorics: the study of the number of ways to put things together into various combinations basic counting principles

More information

CS100: DISCRETE STRUCTURES. Lecture 8 Counting - CH6

CS100: DISCRETE STRUCTURES. Lecture 8 Counting - CH6 CS100: DISCRETE STRUCTURES Lecture 8 Counting - CH6 Lecture Overview 2 6.1 The Basics of Counting: THE PRODUCT RULE THE SUM RULE THE SUBTRACTION RULE THE DIVISION RULE 6.2 The Pigeonhole Principle. 6.3

More information

Discrete Structures Lecture Permutations and Combinations

Discrete Structures Lecture Permutations and Combinations Introduction Good morning. Many counting problems can be solved by finding the number of ways to arrange a specified number of distinct elements of a set of a particular size, where the order of these

More information

Measuring Angles. Measuring Angles. Measuring Angles. Measuring Angles D E G J I K. Use a protractor to measure Also, tell whether the angle is

Measuring Angles. Measuring Angles. Measuring Angles. Measuring Angles D E G J I K. Use a protractor to measure Also, tell whether the angle is 1. 2. ABC DEF A F C B D E 3. 4. GHI JKL G J L H I K 5. 6. MNO PQR O P M N Q R 7. 8. STU VWX S V X T U W 9. 10. ABC DEF B A F E C D 11. 12. GHI JKL I J G H K L 13. 14. MNO PQR M R P N O Q 15. 16. T STU

More information

Counting and Probability

Counting and Probability Counting and Probability What s to come? Probability. A bag contains: What is the chance that a ball taken from the bag is blue? Count blue. Count total. Divide. Today: Counting! Later this week: Probability.

More information

Lecture 1. Permutations and combinations, Pascal s triangle, learning to count

Lecture 1. Permutations and combinations, Pascal s triangle, learning to count 18.440: Lecture 1 Permutations and combinations, Pascal s triangle, learning to count Scott Sheffield MIT 1 Outline Remark, just for fun Permutations Counting tricks Binomial coefficients Problems 2 Outline

More information

CSE 312: Foundations of Computing II Quiz Section #2: Combinations, Counting Tricks (solutions)

CSE 312: Foundations of Computing II Quiz Section #2: Combinations, Counting Tricks (solutions) CSE 312: Foundations of Computing II Quiz Section #2: Combinations, Counting Tricks (solutions Review: Main Theorems and Concepts Combinations (number of ways to choose k objects out of n distinct objects,

More information

Counting. Chapter 6. With Question/Answer Animations

Counting. Chapter 6. With Question/Answer Animations . All rights reserved. Authorized only for instructor use in the classroom. No reproduction or further distribution permitted without the prior written consent of McGraw-Hill Education. Counting Chapter

More information

Introductory Probability

Introductory Probability Introductory Probability Combinations Nicholas Nguyen nicholas.nguyen@uky.edu Department of Mathematics UK Agenda Assigning Objects to Identical Positions Denitions Committee Card Hands Coin Toss Counts

More information

CS70: Lecture Review. 2. Stars/Bars. 3. Balls in Bins. 4. Addition Rules. 5. Combinatorial Proofs. 6. Inclusion/Exclusion

CS70: Lecture Review. 2. Stars/Bars. 3. Balls in Bins. 4. Addition Rules. 5. Combinatorial Proofs. 6. Inclusion/Exclusion CS70: Lecture 18. 1. Review. 2. Stars/Bars. 3. Balls in Bins. 4. Addition Rules. 5. Combinatorial Proofs. 6. Inclusion/Exclusion The rules! First rule: n 1 n 2 n 3. Product Rule. k Samples with replacement

More information

In how many ways can we paint 6 rooms, choosing from 15 available colors? What if we want all rooms painted with different colors?

In how many ways can we paint 6 rooms, choosing from 15 available colors? What if we want all rooms painted with different colors? What can we count? In how many ways can we paint 6 rooms, choosing from 15 available colors? What if we want all rooms painted with different colors? In how many different ways 10 books can be arranged

More information

MAT104: Fundamentals of Mathematics II Summary of Counting Techniques and Probability. Preliminary Concepts, Formulas, and Terminology

MAT104: Fundamentals of Mathematics II Summary of Counting Techniques and Probability. Preliminary Concepts, Formulas, and Terminology MAT104: Fundamentals of Mathematics II Summary of Counting Techniques and Probability Preliminary Concepts, Formulas, and Terminology Meanings of Basic Arithmetic Operations in Mathematics Addition: Generally

More information

Today s Topics. Next week: Conditional Probability

Today s Topics. Next week: Conditional Probability Today s Topics 2 Last time: Combinations Permutations Group Assignment TODAY: Probability! Sample Spaces and Event Spaces Axioms of Probability Lots of Examples Next week: Conditional Probability Sets

More information

Theory of Probability - Brett Bernstein

Theory of Probability - Brett Bernstein Theory of Probability - Brett Bernstein Lecture 3 Finishing Basic Probability Review Exercises 1. Model flipping two fair coins using a sample space and a probability measure. Compute the probability of

More information

Counting Subsets with Repetitions. ICS 6C Sandy Irani

Counting Subsets with Repetitions. ICS 6C Sandy Irani Counting Subsets with Repetitions ICS 6C Sandy Irani Multi-sets A Multi-set can have more than one copy of an item. Order doesn t matter The number of elements of each type does matter: {1, 2, 2, 2, 3,

More information

SMS Dictionary. Solution hint. Input format. Output format. (Indian National Olympiad in Informatics, INOI, 2007)

SMS Dictionary. Solution hint. Input format. Output format. (Indian National Olympiad in Informatics, INOI, 2007) SMS Dictionary (Indian National Olympiad in Informatics, INOI, 2007) In the pre-smartphone era, most mobile phones with numeric keypads had a private dictionary of words to allow users to type messages

More information

2006 Canadian Computing Competition: Junior Division. Sponsor:

2006 Canadian Computing Competition: Junior Division. Sponsor: 2006 Canadian Computing Competition: Junior Division Sponsor: Canadian Computing Competition Student Instructions for the Junior Problems 1. You may only compete in one competition. If you wish to write

More information

CISC-102 Fall 2017 Week 8

CISC-102 Fall 2017 Week 8 Week 8 Page! of! 34 Playing cards. CISC-02 Fall 207 Week 8 Some of the following examples make use of the standard 52 deck of playing cards as shown below. There are 4 suits (clubs, spades, hearts, diamonds)

More information

n! = n(n 1)(n 2) 3 2 1

n! = n(n 1)(n 2) 3 2 1 A Counting A.1 First principles If the sample space Ω is finite and the outomes are equally likely, then the probability measure is given by P(E) = E / Ω where E denotes the number of outcomes in the event

More information

2. Combinatorics: the systematic study of counting. The Basic Principle of Counting (BPC)

2. Combinatorics: the systematic study of counting. The Basic Principle of Counting (BPC) 2. Combinatorics: the systematic study of counting The Basic Principle of Counting (BPC) Suppose r experiments will be performed. The 1st has n 1 possible outcomes, for each of these outcomes there are

More information

CPCS 222 Discrete Structures I Counting

CPCS 222 Discrete Structures I Counting King ABDUL AZIZ University Faculty Of Computing and Information Technology CPCS 222 Discrete Structures I Counting Dr. Eng. Farag Elnagahy farahelnagahy@hotmail.com Office Phone: 67967 The Basics of counting

More information

Sec 5.1 The Basics of Counting

Sec 5.1 The Basics of Counting 1 Sec 5.1 The Basics of Counting Combinatorics, the study of arrangements of objects, is an important part of discrete mathematics. In this chapter, we will learn basic techniques of counting which has

More information

Permutations and Combinations

Permutations and Combinations Permutations and Combinations Introduction Permutations and combinations refer to number of ways of selecting a number of distinct objects from a set of distinct objects. Permutations are ordered selections;

More information

What is counting? (how many ways of doing things) how many possible ways to choose 4 people from 10?

What is counting? (how many ways of doing things) how many possible ways to choose 4 people from 10? Chapter 5. Counting 5.1 The Basic of Counting What is counting? (how many ways of doing things) combinations: how many possible ways to choose 4 people from 10? how many license plates that start with

More information

Problem Set 2. Counting

Problem Set 2. Counting Problem Set 2. Counting 1. (Blitzstein: 1, Q3 Fred is planning to go out to dinner each night of a certain week, Monday through Friday, with each dinner being at one of his favorite ten restaurants. i

More information

With Question/Answer Animations. Chapter 6

With Question/Answer Animations. Chapter 6 With Question/Answer Animations Chapter 6 Chapter Summary The Basics of Counting The Pigeonhole Principle Permutations and Combinations Binomial Coefficients and Identities Generalized Permutations and

More information

Discrete Mathematics and Probability Theory Spring 2014 Anant Sahai Note 11

Discrete Mathematics and Probability Theory Spring 2014 Anant Sahai Note 11 EECS 70 Discrete Mathematics and Probability Theory Spring 2014 Anant Sahai Note 11 Counting As we saw in our discussion for uniform discrete probability, being able to count the number of elements of

More information

CSS 343 Data Structures, Algorithms, and Discrete Math II. Balanced Search Trees. Yusuf Pisan

CSS 343 Data Structures, Algorithms, and Discrete Math II. Balanced Search Trees. Yusuf Pisan CSS 343 Data Structures, Algorithms, and Discrete Math II Balanced Search Trees Yusuf Pisan Height Height of a tree impacts how long it takes to find an item Balanced tree O(log n) vs Degenerate tree O(n)

More information

DISCRETE STRUCTURES COUNTING

DISCRETE STRUCTURES COUNTING DISCRETE STRUCTURES COUNTING LECTURE2 The Pigeonhole Principle The generalized pigeonhole principle: If N objects are placed into k boxes, then there is at least one box containing at least N/k of the

More information

About Permutations and Combinations: Examples

About Permutations and Combinations: Examples About Permutations and Combinations: Examples TABLE OF CONTENTS Basics... 1 Product Rule...1-2 Sum Rule...2 Permutations... 2-3 Combinations... 3-4 Pascal s Triangle... 4 Binomial Theorem.. 4 Pascal s

More information

Section Summary. Permutations Combinations Combinatorial Proofs

Section Summary. Permutations Combinations Combinatorial Proofs Section 6.3 Section Summary Permutations Combinations Combinatorial Proofs Permutations Definition: A permutation of a set of distinct objects is an ordered arrangement of these objects. An ordered arrangement

More information

CSE 100: RED-BLACK TREES

CSE 100: RED-BLACK TREES 1 CSE 100: RED-BLACK TREES 2 Red-Black Trees 1 70 10 20 60 8 6 80 90 40 1. Nodes are either red or black 2. Root is always black 3. If a node is red, all it s children must be black 4. For every node X,

More information

Mat 344F challenge set #2 Solutions

Mat 344F challenge set #2 Solutions Mat 344F challenge set #2 Solutions. Put two balls into box, one ball into box 2 and three balls into box 3. The remaining 4 balls can now be distributed in any way among the three remaining boxes. This

More information

Topics to be covered

Topics to be covered Basic Counting 1 Topics to be covered Sum rule, product rule, generalized product rule Permutations, combinations Binomial coefficients, combinatorial proof Inclusion-exclusion principle Pigeon Hole Principle

More information

COMP 2804 solutions Assignment 4

COMP 2804 solutions Assignment 4 COMP 804 solutions Assignment 4 Question 1: On the first page of your assignment, write your name and student number. Solution: Name: Lionel Messi Student number: 10 Question : Let n be an integer and

More information

SFRA45 QUICK MEASUREMENT GUIDE

SFRA45 QUICK MEASUREMENT GUIDE SFRA45 QUICK MEASUREMENT GUIDE ± 10V pk 50Ω OUTPUT ZOOM+ ZOOM- REAL TIME TABLE GRAPH 1 ABC 2 DEF 3 ACQU SWEEP TRIM GHI 4 JKL 5 MNO 6 COMMS DUT AUX PQRS 7 TUV 8 WXYZ 9 OUT CH1 CH2 +/- 0. DELETE ENTER SYS

More information

Permutations and Combinations Section

Permutations and Combinations Section A B I L E N E C H R I S T I A N U N I V E R S I T Y Department of Mathematics Permutations and Combinations Section 13.3-13.4 Dr. John Ehrke Department of Mathematics Fall 2012 Permutations A permutation

More information

RBT Operations. The basic algorithm for inserting a node into an RBT is:

RBT Operations. The basic algorithm for inserting a node into an RBT is: RBT Operations The basic algorithm for inserting a node into an RBT is: 1: procedure RBT INSERT(T, x) 2: BST insert(t, x) : colour[x] red 4: if parent[x] = red then 5: RBT insert fixup(t, x) 6: end if

More information

Math 3012 Applied Combinatorics Lecture 2

Math 3012 Applied Combinatorics Lecture 2 August 20, 2015 Math 3012 Applied Combinatorics Lecture 2 William T. Trotter trotter@math.gatech.edu The Road Ahead Alert The next two to three lectures will be an integrated approach to material from

More information

MA/CSSE 473 Day 13. Student Questions. Permutation Generation. HW 6 due Monday, HW 7 next Thursday, Tuesday s exam. Permutation generation

MA/CSSE 473 Day 13. Student Questions. Permutation Generation. HW 6 due Monday, HW 7 next Thursday, Tuesday s exam. Permutation generation MA/CSSE 473 Day 13 Permutation Generation MA/CSSE 473 Day 13 HW 6 due Monday, HW 7 next Thursday, Student Questions Tuesday s exam Permutation generation 1 Exam 1 If you want additional practice problems

More information

CSCI 2200 Foundations of Computer Science (FoCS) Solutions for Homework 7

CSCI 2200 Foundations of Computer Science (FoCS) Solutions for Homework 7 CSCI 00 Foundations of Computer Science (FoCS) Solutions for Homework 7 Homework Problems. [0 POINTS] Problem.4(e)-(f) [or F7 Problem.7(e)-(f)]: In each case, count. (e) The number of orders in which a

More information

Self-Adjusting Binary Search Trees. Andrei Pârvu

Self-Adjusting Binary Search Trees. Andrei Pârvu Self-Adjusting Binary Search Trees Andrei Pârvu Andrei Pârvu 13-05-2015 1 Motivation Andrei Pârvu 13-05-2015 2 Motivation: Find Andrei Pârvu 13-05-2015 3 Motivation: Insert Andrei Pârvu 13-05-2015 4 Motivation:

More information

Random Binary Search Trees. EECS 214, Fall 2017

Random Binary Search Trees. EECS 214, Fall 2017 Random Binary Search Trees EECS 214, Fall 2017 2 The necessity of balance 7 0 3 11 1 1 5 9 13 2 0 2 4 6 8 10 12 14 14 3 The necessity of balance n lg n 10 4 100 7 1,000 10 10,000 14 100,000 17 1,000,000

More information

Digital Design Laboratory Lecture 7. A/D and D/A

Digital Design Laboratory Lecture 7. A/D and D/A ECE 280 / CSE 280 Digital Design Laboratory Lecture 7 A/D and D/A Analog/Digital Conversion A/D conversion is the process of sampling a continuous signal Two significant implications 1. The information

More information

Compound Probability. Set Theory. Basic Definitions

Compound Probability. Set Theory. Basic Definitions Compound Probability Set Theory A probability measure P is a function that maps subsets of the state space Ω to numbers in the interval [0, 1]. In order to study these functions, we need to know some basic

More information

Counting & Basic probabilities. Stat 430 Heike Hofmann

Counting & Basic probabilities. Stat 430 Heike Hofmann Counting & Basic probabilities Stat 430 Heike Hofmann 1 Outline Combinatorics (Counting rules) Conditional probability Bayes rule 2 Combinatorics 3 Summation Principle Alternative Choices Start n1 ways

More information

INDEX 1. GENERAL Know your scanner LCD Full Display...2

INDEX 1. GENERAL Know your scanner LCD Full Display...2 INDEX 1. GENERAL...1 2. Know your scanner...1 3. LCD Full Display...2 4. OPERATION...3 4.1 Power on/power off...3 4.2 Volume Alignment...3 4.3 CAR channel Select...3 4.4 Key-lock...3 4.5 CAR channel Scanning

More information

Combinatorics: The Fine Art of Counting

Combinatorics: The Fine Art of Counting Combinatorics: The Fine Art of Counting Lecture Notes Counting 101 Note to improve the readability of these lecture notes, we will assume that multiplication takes precedence over division, i.e. A / B*C

More information

CS 237: Probability in Computing

CS 237: Probability in Computing CS 237: Probability in Computing Wayne Snyder Computer Science Department Boston University Lecture 5: o Independence reviewed; Bayes' Rule o Counting principles and combinatorics; o Counting considered

More information

Dynatel 965DSP / 3M Far-End-Device Setup

Dynatel 965DSP / 3M Far-End-Device Setup Dynatel 965DSP / 3M Far-End-Device Setup For Line Qualification Testing ( Voiceband & Wideband Digital Services ) Welcome Dynatel TM 965DSP Subscriber Loop Analyzer S/N 9751YP w 1998 3M Ver 5..4 USA Setup

More information

CSE 312: Foundations of Computing II Quiz Section #1: Counting (solutions)

CSE 312: Foundations of Computing II Quiz Section #1: Counting (solutions) CSE 31: Foundations of Computing II Quiz Section #1: Counting (solutions Review: Main Theorems and Concepts 1. Product Rule: Suppose there are m 1 possible outcomes for event A 1, then m possible outcomes

More information

Module 3 Greedy Strategy

Module 3 Greedy Strategy Module 3 Greedy Strategy Dr. Natarajan Meghanathan Professor of Computer Science Jackson State University Jackson, MS 39217 E-mail: natarajan.meghanathan@jsums.edu Introduction to Greedy Technique Main

More information

Sec$on Summary. Permutations Combinations Combinatorial Proofs

Sec$on Summary. Permutations Combinations Combinatorial Proofs Section 6.3 Sec$on Summary Permutations Combinations Combinatorial Proofs 2 Coun$ng ordered arrangements Ex: How many ways can we select 3 students from a group of 5 students to stand in line for a picture?

More information

November 6, Chapter 8: Probability: The Mathematics of Chance

November 6, Chapter 8: Probability: The Mathematics of Chance Chapter 8: Probability: The Mathematics of Chance November 6, 2013 Last Time Crystallographic notation Groups Crystallographic notation The first symbol is always a p, which indicates that the pattern

More information

Lesson 9.1 Assignment

Lesson 9.1 Assignment Lesson 9.1 Assignment Name Date Earth Measure Introduction to Geometry and Geometric Constructions Use a compass and a straightedge to complete Questions 1 and 2. 1. Construct a flower with 12 petals by

More information

Permutations And Combinations Questions Answers

Permutations And Combinations Questions Answers We have made it easy for you to find a PDF Ebooks without any digging. And by having access to our ebooks online or by storing it on your computer, you have convenient answers with permutations and combinations

More information

COUNTING TECHNIQUES. Prepared by Engr. JP Timola Reference: Discrete Math by Kenneth H. Rosen

COUNTING TECHNIQUES. Prepared by Engr. JP Timola Reference: Discrete Math by Kenneth H. Rosen COUNTING TECHNIQUES Prepared by Engr. JP Timola Reference: Discrete Math by Kenneth H. Rosen COMBINATORICS the study of arrangements of objects, is an important part of discrete mathematics. Counting Introduction

More information

Combinatorics and Intuitive Probability

Combinatorics and Intuitive Probability Chapter Combinatorics and Intuitive Probability The simplest probabilistic scenario is perhaps one where the set of possible outcomes is finite and these outcomes are all equally likely. A subset of the

More information

Lecture 18 - Counting

Lecture 18 - Counting Lecture 18 - Counting 6.0 - April, 003 One of the most common mathematical problems in computer science is counting the number of elements in a set. This is often the core difficulty in determining a program

More information

LAMC Junior Circle February 3, Oleg Gleizer. Warm-up

LAMC Junior Circle February 3, Oleg Gleizer. Warm-up LAMC Junior Circle February 3, 2013 Oleg Gleizer oleg1140@gmail.com Warm-up Problem 1 Compute the following. 2 3 ( 4) + 6 2 Problem 2 Can the value of a fraction increase, if we add one to the numerator

More information

Week 3 Classical Probability, Part I

Week 3 Classical Probability, Part I Week 3 Classical Probability, Part I Week 3 Objectives Proper understanding of common statistical practices such as confidence intervals and hypothesis testing requires some familiarity with probability

More information

With Question/Answer Animations. Chapter 6

With Question/Answer Animations. Chapter 6 With Question/Answer Animations Chapter 6 Chapter Summary The Basics of Counting The Pigeonhole Principle Permutations and Combinations Binomial Coefficients and Identities Generalized Permutations and

More information

Week 6: Advance applications of the PIE. 17 and 19 of October, 2018

Week 6: Advance applications of the PIE. 17 and 19 of October, 2018 (1/22) MA284 : Discrete Mathematics Week 6: Advance applications of the PIE http://www.maths.nuigalway.ie/ niall/ma284 17 and 19 of October, 2018 1 Stars and bars 2 Non-negative integer inequalities 3

More information

Discrete mathematics

Discrete mathematics Discrete mathematics Petr Kovář petr.kovar@vsb.cz VŠB Technical University of Ostrava DiM 470-2301/02, Winter term 2018/2019 About this file This file is meant to be a guideline for the lecturer. Many

More information

Elementary Combinatorics CE 311S

Elementary Combinatorics CE 311S CE 311S INTRODUCTION How can we actually calculate probabilities? Let s assume that there all of the outcomes in the sample space S are equally likely. If A is the number of outcomes included in the event

More information

RFID Systems, an Introduction Sistemi Wireless, a.a. 2013/2014

RFID Systems, an Introduction Sistemi Wireless, a.a. 2013/2014 RFID Systems, an Introduction Sistemi Wireless, a.a. 2013/2014 Un. of Rome La Sapienza Chiara Petrioli, Gaia Maselli Department of Computer Science University of Rome Sapienza Italy RFID Technology Ø RFID

More information

In this section, we will learn to. 1. Use the Multiplication Principle for Events. Cheesecake Factory. Outback Steakhouse. P.F. Chang s.

In this section, we will learn to. 1. Use the Multiplication Principle for Events. Cheesecake Factory. Outback Steakhouse. P.F. Chang s. Section 10.6 Permutations and Combinations 10-1 10.6 Permutations and Combinations In this section, we will learn to 1. Use the Multiplication Principle for Events. 2. Solve permutation problems. 3. Solve

More information

Well, there are 6 possible pairs: AB, AC, AD, BC, BD, and CD. This is the binomial coefficient s job. The answer we want is abbreviated ( 4

Well, there are 6 possible pairs: AB, AC, AD, BC, BD, and CD. This is the binomial coefficient s job. The answer we want is abbreviated ( 4 2 More Counting 21 Unordered Sets In counting sequences, the ordering of the digits or letters mattered Another common situation is where the order does not matter, for example, if we want to choose a

More information

ACTIVITY 6.7 Selecting and Rearranging Things

ACTIVITY 6.7 Selecting and Rearranging Things ACTIVITY 6.7 SELECTING AND REARRANGING THINGS 757 OBJECTIVES ACTIVITY 6.7 Selecting and Rearranging Things 1. Determine the number of permutations. 2. Determine the number of combinations. 3. Recognize

More information

COCI 2008/2009 Contest #3, 13 th December 2008 TASK PET KEMIJA CROSS MATRICA BST NAJKRACI

COCI 2008/2009 Contest #3, 13 th December 2008 TASK PET KEMIJA CROSS MATRICA BST NAJKRACI TASK PET KEMIJA CROSS MATRICA BST NAJKRACI standard standard time limit second second second 0. seconds second 5 seconds memory limit MB MB MB MB MB MB points 0 0 70 0 0 0 500 Task PET In the popular show

More information

Chapter 7. Intro to Counting

Chapter 7. Intro to Counting Chapter 7. Intro to Counting 7.7 Counting by complement 7.8 Permutations with repetitions 7.9 Counting multisets 7.10 Assignment problems: Balls in bins 7.11 Inclusion-exclusion principle 7.12 Counting

More information

CSE 312: Foundations of Computing II Quiz Section #1: Counting

CSE 312: Foundations of Computing II Quiz Section #1: Counting CSE 312: Foundations of Computing II Quiz Section #1: Counting Review: Main Theorems and Concepts 1. Product Rule: Suppose there are m 1 possible outcomes for event A 1, then m 2 possible outcomes for

More information

5.3 Problem Solving With Combinations

5.3 Problem Solving With Combinations 5.3 Problem Solving With Combinations In the last section, you considered the number of ways of choosing r items from a set of n distinct items. This section will examine situations where you want to know

More information

STATISTICAL COUNTING TECHNIQUES

STATISTICAL COUNTING TECHNIQUES STATISTICAL COUNTING TECHNIQUES I. Counting Principle The counting principle states that if there are n 1 ways of performing the first experiment, n 2 ways of performing the second experiment, n 3 ways

More information

The study of probability is concerned with the likelihood of events occurring. Many situations can be analyzed using a simplified model of probability

The study of probability is concerned with the likelihood of events occurring. Many situations can be analyzed using a simplified model of probability The study of probability is concerned with the likelihood of events occurring Like combinatorics, the origins of probability theory can be traced back to the study of gambling games Still a popular branch

More information

ARTIFICIAL INTELLIGENCE (CS 370D)

ARTIFICIAL INTELLIGENCE (CS 370D) Princess Nora University Faculty of Computer & Information Systems ARTIFICIAL INTELLIGENCE (CS 370D) (CHAPTER-5) ADVERSARIAL SEARCH ADVERSARIAL SEARCH Optimal decisions Min algorithm α-β pruning Imperfect,

More information

Problem A. Worst Locations

Problem A. Worst Locations Problem A Worst Locations Two pandas A and B like each other. They have been placed in a bamboo jungle (which can be seen as a perfect binary tree graph of 2 N -1 vertices and 2 N -2 edges whose leaves

More information

Let s Get This Started!

Let s Get This Started! Lesson 1.1 Assignment 1 Name Date Let s Get This Started! Points, Lines, Planes, Rays, and Line Segments 1. Identify each of the following in the figure shown. a. Name all points. W X p b. Name all lines.

More information

Solutions Manual for the book Introduction to Probability by Joseph K. Blitzstein and Jessica Hwang c Chapman & Hall/CRC Press, 2015

Solutions Manual for the book Introduction to Probability by Joseph K. Blitzstein and Jessica Hwang c Chapman & Hall/CRC Press, 2015 Solutions Manual for the book Introduction to Probability by Joseph K. Blitzstein and Jessica Hwang c Chapman & Hall/CRC Press, 2015 Joseph K. Blitzstein and Jessica Hwang Departments of Statistics, Harvard

More information

A Note on Downup Permutations and Increasing Trees DAVID CALLAN. Department of Statistics. Medical Science Center University Ave

A Note on Downup Permutations and Increasing Trees DAVID CALLAN. Department of Statistics. Medical Science Center University Ave A Note on Downup Permutations and Increasing 0-1- Trees DAVID CALLAN Department of Statistics University of Wisconsin-Madison Medical Science Center 1300 University Ave Madison, WI 53706-153 callan@stat.wisc.edu

More information

Module 3 Greedy Strategy

Module 3 Greedy Strategy Module 3 Greedy Strategy Dr. Natarajan Meghanathan Professor of Computer Science Jackson State University Jackson, MS 39217 E-mail: natarajan.meghanathan@jsums.edu Introduction to Greedy Technique Main

More information

Permutations and Combinations

Permutations and Combinations Motivating question Permutations and Combinations A) Rosen, Chapter 5.3 B) C) D) Permutations A permutation of a set of distinct objects is an ordered arrangement of these objects. : (1, 3, 2, 4) is a

More information

MA/CSSE 473 Day 14. Permutations wrap-up. Subset generation. (Horner s method) Permutations wrap up Generating subsets of a set

MA/CSSE 473 Day 14. Permutations wrap-up. Subset generation. (Horner s method) Permutations wrap up Generating subsets of a set MA/CSSE 473 Day 14 Permutations wrap-up Subset generation (Horner s method) MA/CSSE 473 Day 14 Student questions Monday will begin with "ask questions about exam material time. Exam details are Day 16

More information

Today s Topics. Sometimes when counting a set, we count the same item more than once

Today s Topics. Sometimes when counting a set, we count the same item more than once Today s Topics Inclusion/exclusion principle The pigeonhole principle Sometimes when counting a set, we count the same item more than once For instance, if something can be done n 1 ways or n 2 ways, but

More information

aabb abab abba baab baba bbaa permutations of these. But, there is a lot of duplicity in this list, each distinct word (such as 6! 3!2!1!

aabb abab abba baab baba bbaa permutations of these. But, there is a lot of duplicity in this list, each distinct word (such as 6! 3!2!1! Introduction to COMBINATORICS In how many ways (permutations) can we arrange n distinct objects in a row?answer: n (n ) (n )... def. = n! EXAMPLE (permuting objects): What is the number of different permutations

More information

Discrete Structures for Computer Science

Discrete Structures for Computer Science Discrete Structures for Computer Science William Garrison bill@cs.pitt.edu 6311 Sennott Square Lecture #22: Generalized Permutations and Combinations Based on materials developed by Dr. Adam Lee Counting

More information

Binary Continued! November 27, 2013

Binary Continued! November 27, 2013 Binary Tree: 1 Binary Continued! November 27, 2013 1. Label the vertices of the bottom row of your Binary Tree with the numbers 0 through 7 (going from left to right). (You may put numbers inside of the

More information

Jong C. Park Computer Science Division, KAIST

Jong C. Park Computer Science Division, KAIST Jong C. Park Computer Science Division, KAIST Today s Topics Basic Principles Permutations and Combinations Algorithms for Generating Permutations Generalized Permutations and Combinations Binomial Coefficients

More information

US A1 (19) United States (12) Patent Application Publication (10) Pub. No.: US 2014/ A1 Koh (43) Pub. Date: Nov.

US A1 (19) United States (12) Patent Application Publication (10) Pub. No.: US 2014/ A1 Koh (43) Pub. Date: Nov. US 20140349628A1 (19) United States (12) Patent Application Publication (10) Pub. No.: US 2014/0349628 A1 Koh (43) Pub. Date: Nov. 27, 2014 (54) PORTABLE TERMINAL AND METHOD FOR Publication Classi?cation

More information

Block 1 - Sets and Basic Combinatorics. Main Topics in Block 1:

Block 1 - Sets and Basic Combinatorics. Main Topics in Block 1: Block 1 - Sets and Basic Combinatorics Main Topics in Block 1: A short revision of some set theory Sets and subsets. Venn diagrams to represent sets. Describing sets using rules of inclusion. Set operations.

More information

Solutions to Problem Set 7

Solutions to Problem Set 7 Massachusetts Institute of Technology 6.4J/8.6J, Fall 5: Mathematics for Computer Science November 9 Prof. Albert R. Meyer and Prof. Ronitt Rubinfeld revised November 3, 5, 3 minutes Solutions to Problem

More information

CSE 21 Practice Final Exam Winter 2016

CSE 21 Practice Final Exam Winter 2016 CSE 21 Practice Final Exam Winter 2016 1. Sorting and Searching. Give the number of comparisons that will be performed by each sorting algorithm if the input list of length n happens to be of the form

More information

Permutations and Combinations

Permutations and Combinations Permutations and Combinations Rosen, Chapter 5.3 Motivating question In a family of 3, how many ways can we arrange the members of the family in a line for a photograph? 1 Permutations A permutation of

More information