The goal of this extra assignment is to ensure that you understand how to handle dynamically allocated memory with a certain degree of safety provided by C++ objects. C++ has its own pitfalls (most notably, the possibility of creating a memory leak by forgetting a destructor, and the unwanted side-effects of default copy constructors and operator= ), which you have to learn to avoid. This problem requires a dynamic (self-expanding) table, and some idea about sorting. It will count the same as +25 pts (if perfect) to your midterm score. A working solution without sorting strings in alphabetical order adds +15 pts. Plagiarizm and other forms of cheating will be _severely_ punished. Expand the StringTable class so that the following program (when run on a plain text file) prints all the different words that occur in it, in alphabetical order, with the count of occurences in the text for each word. Notice that the words are printed in a different order than they occur in the text, and that each word is printed exactly once (of course, more frequent words will have a higher count). The program does not require modification to produce the described result. All the necessary intelligence must reside with your StringTable class. int main(){ ifstream f( "sometext.txt" ); if( ! f ) { cerr << "Error opening file\n"; exit(-1); } string s; StringTable words; while( f >> s ) // f >> s fills s with a new word and returns true, // or fails (when at eof) and returns false words.add( s ); // now words contains all words from the file, each with the count // of the number of times it occured words.print(); return 0; } For prototypes of the functions add(..) and print(..) please refer to the midterm solutions. As an extra-extra credit, you can write a function that sorts the strings in the table by the number of occurences, so that you can say which word occurs most frequently in the text (would it be 'a', 'the' or 'and'?) Notice that from the point of view of the program above, any sequence of non-whitespace characters is a word. Whitespace characters (space, newline and tab) are seen as word separators and skipped. Thus you need to remove any punctuation marks except apostrophes before you run the program on your text, so that 'end.' , 'end!', 'end?' and 'end' are not different words. This can be done by another small program, or by search-and-replace in any good text editor. There is also the issue of capital vs. lowercase letters: 'And' and 'and' should be the same word. This issue, unfortunately, cannot be resolved with any text editor (other than Emacs) that I know of. To keep your task simple, I provide a pre-processed text fragment. For the future, keep in mind that both of these preparatory tasks can be carried out with _two_ commands of the UNIX operating system: tr -c '[A-Za-z\n]' ' ' < alice-fragment.txt > alice-proc.0 tr 'A-Z' 'a-z' < alice-proc.0 > alice-proc.txt (the first command changes any character which is not a letter in the ranges A-Z or a-z or a newline \n into a space. The second command changes each capital letter to the corresponding lowercase one. See man tr on your UNIX system for more information.)