Question: Problem statement: C + + Language ( NO PYTHON ) In this assignment you will write a code to read in a tree in the

Problem statement: C++ Language (NO PYTHON)
In this assignment you will write a code to read in a tree in the adjacency matrix format and then print the pre-order, in-order and post-order traversals of the same. For the trees in Q 4(a & b) write the adjacency matrix representation of the trees and feed that adjacency matrix into your code. The code should print the node numbers in the order of the corresponding traversals.
Bindary Trees that need to be converted to Adjanceny Matrix (pictured): please hardcode adjacency matrices into code as the input
Output: PLEASE MAKE SURE CODE HAS THIS EXACT OUTPUT
For tree a), the traversals are as follows:
Pre-order (Root, Left, Right): A, B, D, G, C, E, H, J, K, I, F
In-order (Left, Root, Right): G, D, B, A, J, H, K, E, I, C, F
Post-order (Left, Right, Root): G, D, B, J,K,H, I, E, F, C, A
For tree b), the traversals are as follows:
Pre-order (Root, Left, Right): 42,12,8,2,16,22,19,65,53,60,57
In-order (Left, Root, Right): 2,8,12,19,22,65,16,42,57,60,53
Post-order (Left, Right, Root): 2,8,19,65,22,16,12,57,60,53,42
PLEASE MAKE SURE CODE FULLY WORKS BEFORE POSTING THANK YOU.
Problem statement: C + + Language ( NO PYTHON )

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!