CIS 327 Lab 6

Points: 10 Due Date: October 20, 2003

NOTE: this has been changed to a 10 point EXTRA CREDIT assignment. Doing this lab is OPTIONAL

This will involve trees but it's not so much about implemementing trees as it is in using them. All the tree code you will need is in the example code, but you will have to modify it.

You will read in a file of text. Like the one in the zip file with the executable or one of your own. It should have 40 or 50 words in it, spread over several lines. You will read it in word by word. Words are defined as a bunch of characters seperated by either a space or a end of line. Don't worry about punctuation.

Then each word will be inserted into a binary ordered tree. When you have read all the words and inserted them, you will print a report. This report will list all the words in alphabetical order. For each word, you will print how many times it appears in the text and which word position(s) it appeared at. For example, in the line:
When you have read all the words and inserted them, you will
The word you appears at positions 2,11 and the word read appears at position 4.

Lastly, you will add a method that finds the word that appears the most and prints it along with its count. ALL processing except the initial reading of the file must be done on the finished tree.

For 5 extra points, count how many unique words there are in the tree. For 10 extra points, count the unique words without adding any data fields to the classes or structures and without any global variables nor any variables in the main(). Hint: it's recursive.

If you have questions, just ask.