CS 555 Homework Assignments

There will be assignments of some kind every few weeks. Assignments will be due at the beginning of class on the indicated days unless otherwise stated.

Due February 14
Programming problem
In a programming language of your choice (C, C++ or Perl would be best), write a short program to read in a text document, then calculate the frequency of the 26 alphabetic characters plus the space character. Fold uppercase into lower case (e.g., "A" is the same as "a"). Discard digits ("0", "1", etc). Treat tabs, periods, commas, newlines, and all other punctuation characters as spaces. Treat multiple spaces (or sequences of punctuation and spaces) as a single space. Thus, the string "This Friday night." would have three spaces counted if it appeared on an input line by itself.

(Save this program for use in later homework assignments.)

For purposes of this assignment, apply your program to the text linked in here (an HTML version is available here if you want to view it in a more natural state). You can download a copy of the text with your WWW viewer. Turn in a copy of your code, and the output of running it against this test file.

Extra credit: Have your program calculate the frequency of all digrams (pairs of letters) and trigrams; do not report on combinations that do not occur. Discard any digrams or trigrams that contain digits or spaces (as defined in the first part of the program).

Due February 21 (Friday)
  • This homework is on questions from the book; show all work:
  • problem 1.2
  • problem 1.3
  • problem 1.7
  • problem 1.10
  • problem 2.4
  • problem 2.6
  • Using a simple Vigenère Cipher with the key "springisnear", encrypt the following text (remove punctuation and spaces):
    The purpose of a fish trap is to catch fish,
    and when the fish are caught, the trap is forgotten.
    The purpose of a rabbit snare is to catch rabbits.
    When the rabbits are caught, the snare is forgotten.
    The purpose of words is to convey ideas.
    When the ideas are grasped, the words are forgotten.
    Where can I find a man who has forgotten words?
    He is the one I would like to talk to.
    --Chuang Tzu
    Write the result as a series of 5-character "words" of ciphertext (e.g., "abcde fghij klmno vwxyz"). Pad with random characters to the nearest 5-letter boundary.

  • Using the Playfair cipher as shown in class, encrypt the following pseudo-aphorism:
    Give me a lever long enough, and a place to stand, and I will break my lever.
    Assume that the Playfair tableau is initialized with the phrase "the lazy fox slept in", and the remaining letters are then chosen in reverse alphabetic order (e.g. "w" follows "n"). Remember that "i" and "j" share the spot in the tableau.
  • Due February 24 (Monday)
    Programming problem
    Augment the program you did for the first assignment to do the following with the same sample text:
  • Calculate the entropy of the sample text for single characters.
  • Calculate the actual rate, absolute rate, and redundancy of the sample text.
  • Contrast your answers to the previous question with the values given in class for English. Why are they different/the same?
  • Due March 24 (Monday)
    The following problems from the book
  • 3.4
  • 3.5
  • 3.7
  • 4.1
  • 4.2
  • 4.3
  • 4.5
  • Due April 23 (Wednesday)
  • 5.3
  • 5.4
  • 6.1
  • 6.7
  • 7.2
  • 7.3
  • Extra Credit
  • 5.1
  • 7.5
  • Due May 2 (Friday) [Extra Credit]
    For extra credit, do some or all of:
  • 8.1
  • 8.3
  • 11.2
  • 13.3

  • Gene Spafford