Question: Generic Binary Search Tree Project c + + In this project you will be creating a binary search tree to store words read from the

Generic Binary Search Tree Project c++
In this project you will be creating a binary search tree to store words read from the file specified on the command line, and displaying the contents of the tree in pre- in- and post- order traversals.
Requirements:
If the command line doesnt have 1 argument, an error message should be displayed.
Open the file specified in the command line argument, verify the file opened successfully, if the file fails to open, an error message should be displayed.
Read in the entire file (the code can assume there will only be one word on each line)
As each word is read, add it to a binary search tree
After reaching the end of the file, do a pre-order traversal of the tree, printing out the word stored in each node
Then do an in-order traversal of the tree, again displaying the words as each node is visited. The words should be displayed in alphabetical order.
Ask the user to search for a word or q to quit. Tell the user if the corresponding word is in the binary tree.
After the user selects q to quit, delete all the tree nodes by using a post-order recursive traversal, printing the string stored in the node before it is deleted.
Implementation suggestions:
Use ifstream::open to open the file specified on the command line
Use ifstream::is_open to verify the file opened correctly
Use getline(ifstream, str) function to read a line of text
Use ifstream::eof() to determine when the end of file is reached sample word list hapless
immerse
stretch
oatmeal
occur
eyes
direct
weather
abrasive
boundless
sloppy
uproot
thankful
injure
forgive
bun
adorable
bit
faucet
absent
acidic
party
contrast
woebegone
vacation
vary
puny
hard-to-find
heavenly
body
hearing
aberrant
produce
insert
next
peace
frantic
aggressive
summon
needless

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!