Introduction to Programming (22C:16, 22C:106)

Homework 8: Due Thursday, 4/17/97

Problem 1: [10 points]

You are given two files: names1.dat and names2.dat. Each of these files contains some number of names in sorted order. You can assume that each file contains at least one name. The names within a file are distinct, but there may be names that appear in both files. Write a program that reads the names in both files, and produces a sorted list of distinct names obtained by ``merging'' the names in the two files. So for example, the contents of names1.dat may be:

and the contents of names2.dat may be:

The expected output is:

Problem 2: [10 points]

Solve Problems 6.15 and 6.17 from the Pause to reflect section on pages 289-290.



Sriram Pemmaraju
Thu Apr 10 17:39:28 CDT 1997