Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Using C++ Populate a binary search tree from an input file (input.txt) that contains a list of numbers. The file can also contain the keyword
Using C++ Populate a binary search tree from an input file (input.txt) that contains a list of numbers. The file can also contain the keyword delete followed by a number. Search for a node within the tree for that number and delete it. If the number is not found, insert the node. The tree will not contain any duplicates. Sample input.txt file 1 2 3 delete3 delete 9 Note: delete 8 The above lines will not be in the file because delete 8 will insert a new node since it doesn't exist and then, the 8 on the next line will attempt to insert a second 8, which would be a duplicate. At the end, display the tree in preorder, inorder, and postOrder format. Also, display the tree level by level (breadth search format). The display should be redirected to a file (output.txt). Note: When deleting, make sure to account for no children, one child and two children
Using C++
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