CISC 320 Algorithms and Advanced Programming, Spring 2001

Homework set #2 - Algorithm analysis in the wild

Handed out: March 22, 2001
Due date: April 12, 2001

Note: This assignment is worth 9% of the course grade. It is due in class on April 12, since sketches of the solutions will be handed out on that day. Algorithm analysis and development in the wild (outside of textbooks).

  1. (3%) In Dr. Dobbs Journal, #323, April, 2001 (distibuted in class), on page 145 Jon Bentley says this about the suffix array algorithm he is discussing: "On typical text files of n characters, the algorithm runs in O(n lg(n)) time."

    1. Do you think he is speaking about the worst case time, the average case time, or other? Explain why you think so.

    2. Let Ws(n) be the worst case number of string comparisons made by the algorithm on a text of n characters. Show that Ws(n) is Theta(n lg(n)).

    3. Let Wc(n) be the worst case number of character comparisons made by the algorithm on a text of n characters. Show that Wc(n) is Theta(n2). You must show that Wc(n) is no more than a constant multiple of n2, and by example show that it can be proportional to n2.

  2. (6%) Implement an algorithm to find the longest duplicated substring in a text. Your algorithm must be

    On the due date, implementations will be run on test cases which will not be revealed in advance. These runs will be timed and these times used to evaluate your success in making fast code.