Professional Documents
Culture Documents
Discrete Maths Assignment
Discrete Maths Assignment
k0
3
k
z
k
k0
3
k
z
k
6) Use Newtons binomial theorem to expand the following into a power series:
1
1 4z
2
3
7) Mary made three dozen identical homemade chocolate chip cookies and is going to distribute them to
four families in her neighborhood. Each family must receive at least six cookies. The Landers family
cannot receive more than seven cookies because the mother does not want her family eating too many
sweets. Mary also knows that there are many children in the Johnson family, so she wants to give them
an ample supply of cookies. There are seven people in this family, and Mary wants to make sure that
each family member gets at least two cookies. In how many ways can Mary distribute the chocolate
chip cookies to the four neighborhood families? (Of course you should use generating functions in your
solution strategy.)
Start Date: R Apr 25
Test 3 Chapters 7 & 8
Math 220 Discrete Math
Section 1
Time: Due: R May 8 Calculator: OK
Notes: ???
Form Q 3 of 7
8) Recall Example 7.4.
i) Use pseudocode to write a recursive algorithm for calculating the sum of the rst n positive inte-
gers. You may assume that n will never be less than 1.
ii) Does this algorithm use tail-end recursion?
iii) Use pseudocode to write a non-recursive algorithm for calculating the sum of the rst n positive
integers.
9) Solve the following recurrence relation. (No, I dont want to know what all the numbers are, I want you
to nd a closed-form formula).
a
0
7 and a
n
pn `1qa
n1
, n 1
Start Date: R Apr 25
Test 3 Chapters 7 & 8
Math 220 Discrete Math
Section 1
Time: Due: R May 8 Calculator: OK
Notes: ???
Form Q 4 of 7
10) The following algorithm takes an unsorted list of positive integers, along with two integers x and y. It
returns the largest number, z, in the list such that either z
x
y or z
y
x is true. It returns 0 if no such z
exists. The algorithm assumes that the list size, n, is a power of 2 with n 1.
1 : integer xyMax(x,y,ta
0
, a
1
, . . . , a
n1
u)
2 : if n == 1
3 : if (a
x
0
== y) or (a
y
0
== x)
4 : return a
0
5 : else
6 : return 0
7 :
8 : # process the left half
9 :
10 : m
1
= xyMax(x,y,ta
0
, . . . , a
t
n
2
u1
u)
11 :
12 : # process the right half
13 :
14 : m
2
= xyMax(x,y,ta
t
n
2
u
, . . . , a
n1
u)
15 :
16 : # nd the largest
17 :
18 : max = m
1
19 : if m
2
max
20 : max = m
2
21 :
22 : return max
23 : end xyMax
i) What is the recurrence relation that counts the number of comparisons for this algorithm? (The
critical steps are at lines 2, 3, and 19.)
ii) What is a good big- reference function for algorithm xyMax?
Start Date: R Apr 25
Test 3 Chapters 7 & 8
Math 220 Discrete Math
Section 1
Time: Due: R May 8 Calculator: OK
Notes: ???
Form Q 5 of 7
11) Find a closed-form formula for the following linear homogeneous recurrence relation with constant
coefcients. Do not round off or use calculator approximations: use exact arithmetic!
a
0
2, a
1
2, and a
n
2a
n1
`15a
n2
, n 2
Bonus Problems:
12) Repeat Quick Check 7.1 (page 338) but in line 14 of SubsetSum, always choose the smallest element
of W.
i) Diagram of recursive invocations:
ii) Which strategy (largest element as in the original Quick Check or smallest element as here) seems
better? (Explain your answer.)
Start Date: R Apr 25
Test 3 Chapters 7 & 8
Math 220 Discrete Math
Section 1
Time: Due: R May 8 Calculator: OK
Notes: ???
Form Q 6 of 7
13) Find a closed-form formula for this following linear homogeneous recurrence relation with constant
coefcients. Do not round off or use calculator approximations: use exact arithmetic!
a
0
4, a
1
3, a
2
0, and a
n
3a
n1
3a
n2
a
n3
, n 3
14) A library has four identical display cases that are used to promote new acquisitions. This month, the
librarians wish to promote nine books. They do not want any empty display cases. In how many ways
can the books be displayed?
Start Date: R Apr 25
Test 3 Chapters 7 & 8
Math 220 Discrete Math
Section 1
Time: Due: R May 8 Calculator: OK
Notes: ???
Form Q 7 of 7
15) Find the performance of algorithms with the given recurrence relations.
i) f p1q 11 and f pnq 2 f
`
n
4
`
1
4
log
4
pnq
ii) f p1q 1 and f pnq f
`
n
5
`2
?
n
16) Use a generating function approach to solve the following recurrence relation:
a
0
2, a
1
2, and a
n
2a
n1
`15a
n2
, n 2
Start Date: R Apr 25