Question: Problem statement: C + + Language In this assignment you will write a code to read in a tree in the adjacency matrix format and
Problem statement: C Language
In this assignment you will write a code to read in a tree in the adjacency matrix format and then print the preorder, inorder and postorder traversals of the same. For the trees in Q 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. Please make sure code fully works.
Input Adjanceny Matrix pictured: please hardcode adjacency matrices into code
For the tree a:
ABCDEFGHIJK
A
B
C
D
E
F
G
HOOO
J
K
For the tree b
Output:
For tree a the traversals are as follows:
Preorder Root Left, Right: A B D G C E H J K I, F
Inorder Left Root, Right: G D B A J H K E I, C F
Postorder Left Right, Root: G D B JKH I, E F C A
For tree b the traversals are as follows:
Preorder Root Left, Right:
Inorder Left Root, Right:
Postorder Left Right, Root:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
