Lab 5 - Saruman and Sauron Play with Iterators
Due: Monday, October 18, 2004 at 9:00 AM


Do the laboratory at the end of Chapter 7. There are no practice questions or design for this week because of reading period.

When you implement your SubsetIterator that extends AbstractIterator, be sure to import structure.* and java.util.Iterator at the top of your file. Also remember that your SubsetIterator should be completely generic. It should know nothing about the values of the Objects in the Vector.

For testing, write a main method of your SubsetIterator that creates a Vector with the Integers from 0 through 7, creates a SubsetIterator with this Vector, and then prints out all subsets returned and a count of the subsets returned. Make sure you end up with 256 subsets printed.

Write the main method to solve the two-towers problem in a separate class called TwoTowers, proceeding as specified at the top of p. 165.

When you're finished, create and submit a tar file lab5.tar that includes the following: