#### CSCI 3104 - Algorithms - Spring 2010

### Problem Set #4

#### Due: 2pm, Mar 12th, 2010

1. Text problem 3.8. (If using on-line book, ignore part (c))
2. Text problem 3.21.

3. Text problem 3.24. Justify the correctness and running time of your
algorithm. (Note that it says dag and **not** digraph. If we
ask the same problem about a digraph, there is no known polynomial-time
algorithm!)

4. A **chain of words** is a list of words where the i-th word is the (i-1)st
word with one extra character and some mixing of letters. For example,
AN, TAN, RANT, TRAIN, RETINA, NASTIER is a chain of length 6. Find the
longest chain you can in our
wordlist.

In order to do this, first build a dag. The dag will consist of
a node for each word (you might want to collapse words into a single node
when it makes sense to), and an edge from word x to word y if y can follow
x in a chain. Then run DFS from each source node in the dag and keep track
of the maximum depth you reach. Print out the list of words you find.