Write a c program to read in a set of numbers from an input


Write a C++ program to read in a set of numbers from an input file and build an ordered binary tree. For this tree, compute and print the following.

a. Print out the tree in inorder.

b. Print out the tree in preorder.

c. Print out the tree in postorder.

d. Print out the number of nodes in the tree. (Traverse the tree and count the nodes.)

e. Sum up all the values in the tree and compute the average.

f. Count the number of leaves in the tree.

g. Print the value that is the deepest in the tree.

Input file is named as "TreeData.dat".

I am stuck on this binary tree program. I have attached my code and data file.

Attachment:- Untitled1.zip

Solution Preview :

Prepared by a verified Expert
C/C++ Programming: Write a c program to read in a set of numbers from an input
Reference No:- TGS01245933

Now Priced at $20 (50% Discount)

Recommended (91%)

Rated (4.3/5)