Question: C++ Programming!! Someone please help me with this program using trees!! Read Below for details! Will rate!! Use an ADT called BinTree to hold the
C++ Programming!! Someone please help me with this program using trees!! Read Below for details! Will rate!!
Use an ADT called BinTree to hold the binary tree and an ADT name BTNode to hold the binary tree nodes, you can make use of the code example binary_tree_node.
Each node in the binary tree must contain ONLY 3 data items.
a char variable to contain a single letter from the English alphabet
a pointer variable to point to a left child node
a pointer variable to point to a right child node
All valid input will be single characters, separated by one or more blanks. More than one input value may appear on a single line. Multiple lines of input may be present. Blank lines may appear in the input file. The file will not be entirely empty (i.e. there will be at least a single valid character). Also we assume that each character will appear at most once in the input file.
(4)For each input character, you are to place it into the binary tree. When properly placed, an in-order traversal of the binary tree will allow the data to be printed in non-decreasing order.
Implement the BinTree and BTNode ADTs and their methods to do the following traversals on your binary tree. During any traversal, your algorithm must print the character content out to the screen and to an output file named "outfile.txt". You should always display a copy of the input along with the resultant output. Below are the traversals to implement.
Post-Order Traversal
Pre-Order Traversal
In-Order Traversal
Below is a suggestion of what would be an acceptable format of output file. Make sure it is well labeled and very easy to understand without having to look at ANYTHING else.
Tree Traversal Report Input Data: m f s d h o u a e g i n q t x Post-Order: a e d g i h f n q o t x u s m Pre-Order : m f d a e h g i s o n q u t x In-Order : a d e f g h i m n o q s t u x
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
