CS 173: Discrete Mathematical Structures - PowerPoint PPT Presentation

1 / 28
About This Presentation
Title:

CS 173: Discrete Mathematical Structures

Description:

If n pigeons fly into k pigeonholes and k n, then some pigeonhole contains at ... Suppose you have time to listen to 10 songs on your daily jog around campus. ... – PowerPoint PPT presentation

Number of Views:32
Avg rating:3.0/5.0
Slides: 29
Provided by: mikeha5
Category:

less

Transcript and Presenter's Notes

Title: CS 173: Discrete Mathematical Structures


1
CS 173Discrete Mathematical Structures
  • Cinda Heeren
  • heeren_at_cs.uiuc.edu
  • Siebel Center, rm 2213
  • Office Hours M 11a-12p

2
CS 173 Announcements
  • Homework 8 available. Due 10/31, 8a.
  • Midterm 2 11/9, 7-9p. Email me with conflicts.

3
CS173On to recursive algorithms
  • I need 8 volunteers.
  • MergeSort (list)
  • If list 1 then return list
  • else
  • MergeSort(left half of list)
  • MergeSort(right half of list)
  • Merge(left half of list,right half of list)

4
CS173On to recursive algorithms
  • Write down the recurrence relation
  • T(n)

2 T(n/2)
cn
  • Well talk about techniques for solving it later.

5
CS173On to recursive algorithms
  • Recursive function for computing the nth
    Fibonacci number
  • Iterative function for computing the nth
    Fibonacci number

6
CS173On to recursive algorithms
  • An appropriate recurrence relation for binary
    search is
  • T(n) C T(n-1)
  • T(n) C T(n/2)
  • T(n) n T(n/2)
  • Depends on the data.

7
CS173Counting
  • Suppose you have 4 shirts, 3 pairs of pants, and
    2 pairs of shoes. How many different outfits do
    you have?

8
CS173Product Rule
  • How many functions are there from set A to set B?

A
To define each function we have to make 3
choices, one for each element of A.
How many ways can each choice be made?
9
CS173Product Rule
  • How many one-to-one functions are there from set
    A to set B?

A
To define each function we have to make 3
choices, one for each element of A.
How many ways can each choice be made?
10
CS173Counting
  • A locker code is a sequence of 3 letters where
    the first letter is a consonant, the second
    letter is a vowel, and the third letter is Z, OR
    the first letter is a vowel, and the second and
    third letter together are a state abbreviation.
  • Are there enough locker codes for everyone in
    this room?

11
CS173Decision Tree
  • Suppose you have 4 shirts, 3 pairs of pants, and
    2 pairs of shoes. How many different outfits do
    you have?

12
CS173 Decision Tree
  • How many different best of 5 game series are
    possible between the Cardinals and the Astros?

13
CS173Pigeonhole Principle
If n pigeons fly into k pigeonholes and k lt n,
then some pigeonhole contains at least two
pigeons.
14
CS173Pigeonhole Principle
If n pigeons fly into k pigeonholes and k lt n,
then some pigeonhole contains at least two
pigeons.
15
CS173Pigeonhole Principle
Let S contain any 6 positive integers. Then,
there is a pair of numbers in S whose difference
is divisible by 5.
Let S a1,a2,a3,a4,a5,a6. Each of these has a
remainder when divided by 5. What can these
remainders be?
6 numbers, 5 possible remainderswhat do we know?
Consider that pair, ai and aj, and their
remainder r. ai 5m r, and aj 5n r.
Their difference ai - aj (5m r) - (5n r)
5m - 5n 5(m-n), which is divisible by 5.

16
CS173Pigeonhole Principle
Six people go to a party. Either there is a
group of 3 who all know each other, or there is a
group of 3 who are all strangers.
If any of those 3 know each other, we have a blue
?, which means 3 people know each other. So they
all must be strangers.
She either knows or doesnt know each other
person.
But then weve proven our conjecture for this
case.
But there are 5 other people! So, she knows, or
doesnt know, at least 3 others.
The case where she doesnt know 3 others is
similar.
17
CS 199 Ice Cream Cones
Do these two cones provide the same ice cream
experience?
18
CS173 Permutations
In a running race of 12 sprinters, each of the
top 5 finishers receives a different medal. How
many ways are there to award the 5 medals?
12
11
10
9
8
A permutation is an ordered arrangement of
objects.
The number of permutations of r distinct objects
chosen from n distinct objects is denoted P(n,r).
19
CS173 Permutations
Suppose you have time to listen to 10 songs on
your daily jog around campus. There are 6 Cake
tunes, 8 Moby tunes, and 3 Eagles tunes to choose
from. How many different jog playlists can you
make?
20
CS173 Permutations
Suppose you have time to listen to 10 songs on
your daily jog around campus. There are 6 Cake
tunes, 8 Moby tunes, and 3 Eagles tunes to choose
from. Now suppose you want to listen to 4 Cake, 4
Moby, and 2 Eagles tunes, in that band order.
How many playlists can you make?
21
CS173 Permutations
Suppose you have time to listen to 10 songs on
your daily jog around campus. There are 6 Cake
tunes, 8 Moby tunes, and 3 Eagles tunes to choose
from. Finally, suppose you still want 4 Cake, 4
Moby, and 2 Eagles tunes, and the order of the
groups doesnt matter, but you get dizzy and fall
down if all the songs by any one group arent
played together. How many playlists are there now?
22
CS173 Permutations
In how many ways can 5 distinct Martians and 3
distinct Jovians stand in line, if no two Jovians
stand together?
23
CS173 Combinations
A combination is an unordered selection of
elements from some set.
The number of combinations of r distinct objects
chosen from n distinct objects is denoted by
C(n,r) or nCr or , and is read n choose r.
C(n,r) P(n,r)/r! n!/((n-r)!r!)
24
CS173Combinations
A basketball squad consists of 12 players, 5 of
which make up a team. How many different teams
of players can you make from the 12?
Whats the diff?
In a running race of 12 sprinters, each of the
top 5 finishers receives a different medal. How
many ways are there to award the 5 medals?
25
CS173 Combinations
A committee of 8 students is to be selected from
a class consisting of 19 frosh, and 34 soph. In
how many ways can 3 frosh and 5 soph be selected?
26
CS173 Combinations
A committee of 8 students is to be selected from
a class consisting of 19 frosh, and 34 soph. In
how many ways can a committee with exactly 1
frosh be selected?
27
CS173 Combinations
A committee of 8 students is to be selected from
a class consisting of 19 frosh, and 34 soph. In
how many ways can a committee with at most 1
frosh be selected?
28
CS173 Combinations
A committee of 8 students is to be selected from
a class consisting of 19 frosh, and 34 soph. In
how many ways can a committee with at least 1
frosh be selected?
Write a Comment
User Comments (0)
About PowerShow.com