Edits in orange made 28 October 2005.
Edits in green made 30 October 2005. (Minor clarifications only.)
Edit in purple made 31 October 2005 (also minor).
Edits in pink made 4 November 2005 (more significant).
There are five questions for 100 total points. Most are based on lectures 12-15, and thus on Chapter 6 of the Adler notes. Question 1 is based on lectures 8-11 (Chapter 5). Many of these problems, like much of Adler's Chapter 6, are taken from Randomized Algorithms by Motwani and Raghavan.
Students are responsible for understanding and following the academic honesty policies indicated on the course main page.
Problem 3.1 (20): Kleene's Theorem says that a language A ⊆ Σ* is the language of an NFA or DFA iff it is denoted by a regular expression. When I present this in CMPSCI 250, I normally prove that NFA's can be simulated by regular expressions using the state elimination method, which is better for hand calculation. Here you'll describe and analyze another method, using dynamic programming.
Let N be an NFA with n states, called {1,...,n}. Given any states s and t and any number i with 0≤i≤n, we define the language L(s,t,i) to be the set of strings that could be read by N, starting in state s, ending in state t, and using no intermediate state numbered greater than i (recall the definition of intermediate state from the Floyd-Warshall algorithm).
Show that using dynamic programming, we can calculate regular expressions for each language L(s,t,i) using a number of regular-expression operations that is polynomial in n. State and justify a bound on how long the regular expressions might be, in terms of n. (Originally said "time polynomial in n".)
(A regular expression is a letter or ∅, the union or concatenation of two regular expressions, or the star of a regular expression. The letters and ∅ are defined to have length 1. If R has length r and S has length s, then R+S and RS are each defined to have length r+s+1, and R* is defined to have length r+1.)
Problem 3.2 (30): Consider a full ternary tree of height h, whose 3h leaves are each labeled with 0 or 1. We want to evaluate this tree in the following way -- each internal node is to be given a label that is the majority element of the labels of its three children.
Problem 3.3 (20): If n is any integer, φ(n) is the number of elements of the group Zn*, which is the product of the numbers pe-pe-1 for every maximal prime-power factor pe of n. If n is prime, φ(n) = n-1, and if n = pq with p and q prime, φ(n) = (p-1)(q-1). (The definition of φ(n) originally posted was incorrect in the case where n is not the product of distinct primes.)
Problem 3.4 (20): Here are two applications of Chernoff bounds -- you may use the results quoted in the Adler text without proof. In each part ε is a fixed positive real number, to be treated as a constant with respect to n.
Problem 3.5 (10): (from CLRS) We have n oil wells in a square area, each with an x-coordinate and a y-coordinate. We are going to build an east-west pipeline across the region, and connect each well to the pipeline by a north-south pipe. How can we choose a y-coordinate for the east-west pipeline that will minimize the total length of the north-south pipes? Describe an algorithm to do so and analyze its running time. Argue that no other algorithm can be asymptotically faster than yours.
Last modified 4 November 2005