CS 161 - Algorithms Homework 4, 25 Points
Due: Friday, November 2, 2012

  1. 5 points. Problem R-5.4 from Goodrich-Tamassia.
  2. 5 points. Problem C-5.5 from Goodrich-Tamassia.
  3. 5 points. Problem C-5.8 from Goodrich-Tamassia. See the figure below for an example, and click here for a hint.

  4. 5 points. Problem C-5.10 from Goodrich-Tamassia.
  5. 5 points. An American spy is deep undercover in the hostile country of Phonemia. Not wanting to waste scares resources, any time he wants to send a message back home, he removes all the punctuation and converts all the letters to uppercase. So, for example, to send the message, “Meet at the Dark Cabin,” he would transmit
    “MEETATTHEDARKCABIN.”
    Given such a string, S, of n uppercase letters, describe an efficient way of breaking it into a string of valid English words. You may assume that you have a function, valid(s), which can take a character string, s, and return true if and only if s is a valid English word. What is the running time of your algorithm, assuming each call to the function, valid, runs in O(1) time?