The following is a checklist which provides a summary of the assignment. This is meant only as a supplement; please read the original assignment description.
[Michael 3/26] "If there are three or more equal substrings, do I have
to print out the index of the first two?"
No. Feel free to print out any two, so long as those two form an
example of a longest matching pair.
[Michael 3/24] "Can the longest string include space characters?"
Certainly. You should be working over a 27-character alphabet.
[Michael 3/24] "What exactly is a character access?"
Assume that the array of characters is sitting in some room under lock
and key, and that every time you need to know a single character, you
pay to send someone into the room to retrieve it. More concretely,
assume the raw data is in an array a[]. How many times in
the execution of your program is some expression a[foo]
evaluated?
So if you have a line if (a[i]==a[j]), you have two accesses.
If you have a line if (a[i]==' '), you have made one access.
If you have a line c = a[i] for a local variable c,
you have made one access (and you can continue to use c
without paying for accesses so long as the variable remains unchanged).
NOTE: the character access count is one way for us to profile
your efficiency, but the real test will be your running time, so don't
waste time just to artificially cut down the access count.
Inputfile | Original Source | N | M's time(sec) | M's avg access | |
princeton | A Packet article about the town | 7527 | 0.21 | 37 | |
amendments | Constitutional Amendments | 17835 | 0.53 | 92 | |
y2kintro | recent Senate report on Y2K | 20450 | 0.42 | 44 | |
baby | How baby's learn language | 21362 | 0.46 | 40 | |
manifesto | Communist Party Manifesto | 70661 | 1.92 | 54 | |
muchado | Much Ado about Nothing | 115489 | 2.74 | 44 | |
aesop | collection of Aesop fables | 182188 | 4.55 | 46 | |
starr | The Starr Report narrative | 221060 | 7.18 | 69 | (warning: explicit language) |
lilwomen | Little Women | 963127 | 27.20 | 48 | |
mobydick | Moby Dick | 1137324 | 31.90 | 46 |