Question
Java please For this assignment, you will implement a binary search tree and use it to store a large text file. Your program should read
Java please
For this assignment, you will implement a binary search tree and use it to store a large text file. Your program should read text from a file and insert each word in a binary search tree. Do not store duplicate text.
Once the tree is populated, print the contents of the tree using an in-order traversal. Next, allow the user to enter words to search for. For each word entered, your program should report the number of elements inspected and whether or not the word was located. Next, allow the user to enter words to remove from the tree. After each removal, print the contents of the tree.
Here is a sample run:
C:\Users\Lydia.Fritz CplusplusProj\TreeProj\Debug Tree Proj.exe are, been, birds, did, even, fish, for, hear, heard?, hot, i, it's, just, like, mosquitoes, now, on, rising, river, seven, speak, the, there's, to, too, up, weeks, what, you, Enter string, enter -1 to quit: honey Inspected 9 elements honey' not in tree Enter string, enter -1 to quit: fish Inspected 2 elements fish' located Enter string, enter -1 to quit: birds Inspected 4 elements birds located Enter string, enter -1 to quit: there's Inspected @ elements 'there's located Enter string, enter -1 to quit: -1 Enter string to remove: too are, been, birds, did, even, fish, for, hear, heard?, hot, i, it's, just, like, mosquitoes, now, on, rising, river, seven, speak, the, there's, to, up, weeks, what, you, Enter string to remove: even are, been, birds, did, fish, for, hear, heard?, hot, i, it's, just, like, mosquitoes, now, on, rising, river, seven, speak, the, there's, to, up, weeks, what, you, Enter string to remove: quit are, been, birds, did, fish, for, hear, heard?, hot, i, it's, just, like, mosquitoes, now, on, rising, river, seven, speak, the, there's, to, up, weeks, what, you, Enter string to remove: -1
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started