MATH 302 – Discrete Mathematics – Section 501 Homework 8

advertisement
Dr. Timo de Wolff
Institute of Mathematics
www.math.tamu.edu/~dewolff/Fall14/math302.html
MATH 302 – Discrete Mathematics – Section 501
Homework 8
Fall 2014
Due: Friday, November 21st, 2014, 9:10 a.m.
When you hand in your homework, do not forget to add your name and your UIN.
Exercise 1. Assume a dice is rolled five times. How many combinations exist, which
contain in total at least two 1’s?
Exercise 2. How many possibilities exist to place 8 rooks on a chessboard such that no
rook can capture another one with one move? Explain your answer.
Exercise 3. In our garden live a couple of lizards, which can change their color. I made
the following observations:
1. There are 5 (distinguishable) lizards: 2 live under the house, 2 in the old tree and 1
in the shed. They change their color only between gray, brown and green.
2. The 2 lizards under the house are always gray.
3. The 2 lizards in the old tree have an arbitrary color, but they never have the same
color.
4. The lizard in the shed always has the same color as one of the other lizards.
How many combinations of colors can the 5 lizards in our garden have?
Exercise 4. Consider the following random experiment. A little (very simple) robot can
take two actions: move right 1 inch and move left 1 inch. He acts according to the
following pseudocode described in the algorithm Robot Algorithm.
Assume that maxsteps := 401 and all 401 random numbers move are chosen distinctly.
What is the least value of maxposition? Explain your answer.
Hint: Use the theorem about the minimal length of in- and decreasing subsequences from
the lecture.
1
Input: maxsteps ∈ N.
Output: maxposition
begin
count := 0
position := 0
maxposition := 0
lastmove := 0
while count < maxsteps do
count := count +1
move := random(Q)
if move > lastmove then
move right 1 inch
position := position +1
else if move < lastmove then
move left 1 inch
position := position −1
lastmove := move
if |position| > maxposition then
maxposition := |position|
return maxposition.
Algorithm 1: Robot Algorithm
2
Download