Indexing Julius Caesar

Murder of Caesar

"Friends, Romans, countrymen, lend me your ears!” is perhaps the most famous line from Mark Antony’s speech at the end of Shakespeare’s Julius Caesar. To set the scene: Brutus and a group of other Roman senators have just murdered Julius Caesar in the middle of the Senate. Brutus then explains this egregious act to the gathering of Romans outside, and now Julius Caesar’s friend Mark Antony (who did not participate in the murder) responds to what Brutus has said:

In this assignment, you will be practicing the process of indexing using text from Mark Antony’s famous speech from Act III, Scene II in William Shakespeare’s Julius Caesar. In pairs, you and your partner will build separate indexes for the document using Processing, looking for specific terms and phrases, and using them to speed up searches of the text.

First, download the following Processing program that you will use to read and mark text in the famous speech.

Click to Download: IndexingJuliusCaesar

The starter code contains the speech and a stop watch. Each time you click on a word, it will be highlighted in yellow. In pairs, examine the entire text and click to highlight each of the matching terms you find. A list of terms for each partner is found below. You will use each term, one at a time, and record your elapsed times.

Partner 1’s Terms and Phrases Partner 2’s Terms and Phrases
Caesar Brutus
he him
noble honorable
ambitious ambition


You will first search the text using Algorithm A and share the length of time that it takes you to search for each of the terms in your assignment submission. You will then repeat the search using Algorithm B, which provides a means of indexing the text in the file.

Before running the Processing program, edit the first two lines of code to initialize the search term and algorithm as follows:

String word = “Caesar";
String algorithm = “A";

Note that the value of word should be initialized to whichever search term you are looking for and algorithm should be initialized to either A or B, depending on which of the following algorithms you are testing.

Search for each of your assigned search terms using Algorithm A.

Search Algorithm A

1) start the timer
2) note your search term
3) repeat for each word in the original text...
4)   ...if the word matches your search term...
5) to mark the occurrence of the term
6) stop your timer
7) record the time

Now, you will perform the same task, only you are allowed to use an index that highlights each line in which your search term appears. Search for each of your assigned search terms using Algorithm B. Don’t forget to modify the word and algorithm values in the Processing program.

Search Algorithm B

1) start the timer
2) note your search term
3) repeat for each red line in the original text...
4)   ...repeat for each word on the highlighted line...
5)        ...if the word matches your search term...
6)    to mark the occurrence of the term
7) stop the timer
8) record the time

Compare your results with your partner and discuss the differences between searching for a keyword with and without an index that identifies the lines where the keyword can be found.

Assignment Submission

When you complete both indexing algorithms, submit a document containing the following information:

  1. The recorded times for completing each of the searches.
  2. Answers to the following questions:
    1. Which of the two methods was quicker? Why?
    2. Imagine that the text was expanded beyond the speech to all of the play. Which method would be better, and why? What difference would the length of the text make?