CSCI 3104 - Algorithms - Spring 2011

Problem Set #5

Due: 12pm, Feb 23rd, 2011

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

2. Suppose you are trying to buy a digraph from a salesman Joe. You tell Joe that your graph cannot have any odd-length cycles, and must be strongly-connected. Joe says he has just the thing, and he shows you just three edges of it: (a, b), (b, c) and (a, c). Explain why Joe must be lying. (Note: there might be a LOT more edges, but you have to base your answer on just the three you can see.)

3. Text problem 3.21.

4. 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!)

5. 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 an example chain that has maximum length (there will be a TON... just give one chain).