CSCI 3650
Summer 2004
Homework Assignment 4

Due: Friday, June 11. Please make your solutions clear and readable.

  1. Exercise 15-2 (Typesetting a paragraph). Replacement for advice given in class: Just compute Pi = the mininum penalty for typesetting the first i words into a paragraph, with full justification (left and right) on every line, including the last. Think about how to compute Pi. Use the "shop around" idea. Then think about how to handle the special case of the last line, which is not stretched to the right margin.

  2. Exercise 15-4 (Company party). Design your algorithm to sweep up the tree. Think of a scan algorithm. What do you need to remember at each node? What are your choices at each node? You can describe your algorithm by defining what to remember at a node, and how to compute it, given the conviviality of that node and the information at the children of that node.

  3. Exercise 15-6 (Checkerboard). How can you solve this if you write, in square s, the best that you can achieve if you start in square s?