Your task is simple. I will provide you with a text document. You will read every word of that document and tell me which words are most common.
Your output will look something like this:
the: 8127 of: 6125 for: 513 expectorate:2 Alphabetically highest word: Zebra Alphabetically lowest word: Aardvark |
You must use a binary tree in your code. Each element of the tree will look like this:
class word { int count; // How many uses found of this word String word; // What is the word word *higher, *lower; // A pointer to two subtrees, containing other words } |
You may use a dummy head node if you want.
Points |
Task |
10 |
Has a binary tree that knows word to add a word and count words. |
2 |
Can print the alphabetically highest and lowest words found (using the binary tree). |
5 |
Can read its input from a file. |
10 |
Can print the words in order alphabetically |
10 |
Can print the words in order by count, |
8 |
Turned in on or before Thursday October 3rd. |
-8 |
Turned in after Wednesday, October 9th. |
There us a tutorial on file I/O in C++ at http://cplus.about.com/library/weekly/aa051802a.htm
There is a tutorial on the string class in C++ at http://www.yolinux.com/TUTORIALS/LinuxTutorialC++StringClass.html
There is an example of file I/O in C++ at http://euclid.nmu.edu/~randy/Classes/CS201/Binary-Tree-Assignment/fileIO.cpp
There is an example data file at http://stealthboy.dyndns.org/~msherman/holmes/adventures/IDEN.txt