Due Wednesday, December 04, 2019
Your task is to use a binary tree as the data structure to create a dictionary by storing a list of known words in a tree and then comparing the words in another file against those words.
Design and write a C++ program that reads a file of text called p5dict.txt and stores each unique word in some node of a binary search tree. Next, read the words from a second data file and search for them in the tree. If a word from the second file p5suspect.txt is found in the dictionary tree, it is treated as being correct and nothing more needs to be done. If a word from the second file is not found, two possibilities exist: either it is correctly spelled – in this case the program asks the user if this word should be inserted into the binary tree; if the user answers ‘y’ or ‘Y’, it is inserted in the dictionary; if the user answers ‘n’ or ‘N’, the word is considered to be mis-spelled and is printed out with a status message to that effect.
All work is to be done under the Linux operating system on Sam. Files from Sam must be brought across to your computer for printing, using Fugu or WinSCP. Do not use MS Word to open the file on your local machine.
Programs must be commented properly, lines must be indented consistently and the names of the variables must be short and indicative of the purpose or type of the variable.
Your written report must be free of ordinary grammatical and syntactical errors. Use a spelling checker.
Submit the following to Canvas no later than midnight on Dec 04, 2019
- A text file containing your pseudocode. Your pseudocode must be detailed enough for the algorithm to be discernible.
- Your C++ code.
- A script file of your terminal session. To do this type the following commands:
- script txt
- now run your program as you would do normally
The script file called yourname.txt (use your own name) contains the log of your entire terminal session. This is the file that must be printed and submitted.
- A one-page memo written on a word processor that discusses the task and what was accomplished, the design choices that were made, the correctness of your program by referring to a snippet of the output (taken from the script file), and what you have learned in this project technically and otherwise.
Policy on Consulting Others
You are not permitted to use any source other than your textbook, your instructor, or the tutors from the QS center. You may discuss the projects at a high level of abstraction with your classmates as long as you do not give or receive programs or code fragments from them.