Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a program to maintain a general BST. Input: use a file, input.txt + 3 means inserting 3 into the current BST tree if the
Write a program to maintain a general BST.
Input: use a file, input.txt
+ 3 means inserting 3 into the current BST tree if the new value is not in the current BST tree. 5 means deleting 5 from the current BST tree if 5 is in the BST tree.
Output:
A list of distinct values in an ascending order by using inorder traversal method.
A list of values in the same format using a preorder traversal method.
input.txt is
+ 34, + 45, + 23, + 54, + 66, + 7, + 4, + 55, + 98, + 17, + 8, + 38, + 29, + 49, + 59, + 93, + 83, + 69, + 77, + 25, + 18, + 8, - 66, - 17, + 81, + 2, + 53, + 72, - 77, - 81, + 10, - 49, - 34, + 41, + 2, + 96, - 23, -4, + 49, + 77, + 51, - 53, - 88, - 6, + 6, + 50, + 91, + 14, - 81, - 45, - 54, - 55, - 29, - 38, - 20, + 88, + 45, + 95, + 52, + 42, - 49, + 35, + 54, - 88, - 52, + 82
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