Reference no: EM131085021
Assignment 4-
1. For each of the following sequences a0, a1, a2, . . . , determine a closed form for the generating series A(x) = a0 + a1x + a2x2 + · · · .
(a) an = 0 if n is odd, an = 3n if n is even.
(b) an = i=0∑nbicn-i where the sequence b0, b1, b2, . . . has generating 1/(1-x)2 and the sequence c0, c1, c2, . . has generating series 1/√(1-x).
2. Briefly explain why the number of ways to change n cents into pennies, nickels, dimes, and quarters is the coefficient of xn in
1/(1 - x)(1 - x5)(1 - x10)(1 - x25),
and use this along with a computer to determine the number of ways of changing a dollar into pennies, nickels, dimes and quarters.
3. In this problem, we will show that the average number of comparisons in the QUICKSORT algorithm for sorting n distinct numbers is O(n log n). This algorithm takes a list of n distinct numbers, and sorts them in order from least to greatest. The algorithm runs as follows. First, select a random number p in the list. Then, compare p to all other elements in the list. If an element is less than p, place it in the list anywhere before p. If an element is greater than p, place it in the list anywhere after p. Then, recursively apply this algorithm to the sublist of elements falling before p, and the sublist of elements falling after p, while leaving p in its place. Thus, if an is the average number of comparisons in the QUICKSORT algorithm to sort n distinct numbers, we have a0 = 0 and for n ≥ 1,
an = n - 1 + (1/n) i=0∑n(ai-1 + an-i)
(a) Let f(x) be the generating series for the sequence {a0, a1, a2, . . .}. Deduce that
f'(x) - (2/1 - x)f(x) = 2x/(1 - x)3.
(b) Using differential equations, one can conclude (formally) that
f(x) = -2(x + log(1 - x))/(1 - x)2
(you do not need to show this). Use this, along with the fact that there is a constant M > 0 such that k=1∑n 1/k < M · log n (you can assume this result), to show that there is a constant C > 0 such that the average number of comparisons in the QUICKSORT algorithm is less than C · n log n.
4. Let A ⊂ {0, 1}∗ be the set of binary strings in which each block of 0s has odd length, and each block of 1s has length one or two. Let A(x) = n=0∑∞anxn be the generating series for A with respect to length (i.e. with respect to the weight function ω: A → {0, 1, 2, 3, . . .} given by ω(a) = number of bits in a). Show that every string in A can be uniquely described by the regular expression
(∅ ∪ (00)∗0)((1 ∪ 11)(00)∗0)∗(∅ ∪ 1 ∪ 11).
and use this to find A(x), and hence a recurrence equation for an.
5. A beautiful theorem of Lagrange allows us to extract coefficients of generating series that satisfy certain functional equations. Lagrange's Theorem states that if f(x) is a generating series that satisfies the functional equation f(x) = x · g(f(x)) where g is some other function, then
[xn]f(x) = 1/n[yn-1]gn(y).
We will use this to count cubic plane planted trees. A cubic plane planted tree is a plane planted tree, all of whose vertices are adjacent to at most 4 other vertices.
(a) Let C be the set of cubic plane planted trees, and let ∈ be the unique cubic plane planted tree with only one non-root vertex (as in class). Explain why there is a bijection between C - { ∈} and
k=1∪3{ ∈} × Ck
that preserves the number of non-root vertices and deduce that if C(x) is the generating series for C with respect to the weight function ω: C → {0, 1, 2, . . .} defined by ω(c) = number of non-root vertices in c, then
C(x) = x · (1 - C4(x)/1 - C(x)).
(b) Use Lagrange's Theorem to deduce that the number of cubic plane planted trees on n vertices is