Out: Tue 30 September 1997 Due: Tue 7 October 1997
Programming Assignment
Starting form the example code for a Tree Object, add an input which prompts for a file name and adds the characters in the file stream to the tree. See InputIntegers.C for an example of file stream input.
Add methods internalPathLength which computes the internal path length of the tree. (See Chapter 4 and also page 208 of Algorithms for an explanation of this term.) You will also write the method numberOfNodes which returns the integer number of nodes in the tree. Try your program on these sample inputs and compute whether the resulting path lengths are close to the average as given by the formula on page 208 of Algorithms.
Submitting Homework:
Call your program MyTreeOne.C, and any resubmissions MyTreeOne.C.n where n is an integer 0, 1, 2, etc. Use the command
PostIt MyTreeOne.Cto submit your homework on or before midnight of the due date.