Trying to learn please answer clearly with step by step instructions for both pa
ID: 3560250 • Letter: T
Question
Trying to learn please answer clearly with step by step instructions for both parts. Thanks.
PRACTICE SET Q1
1. Object is to define a postorder and preorder traversal of the following (below):
[(-3 + 5) * 2] / [4 / (2 + x) ]
a. postorder:
b. preorder:
PRACTICE SET Q2
2. Objective is to construct a postorder, inorder and preorder transversal of using Tree Z below.
a. postorder:
b. inorder:
c: preorder:
Tree Z
Construct a Tree with (start):
vertex a at level 0;
vertices b, c and d at level 1;
vertices e, f, i, j, and k at level 2;
vertices g, h, l, m, and n level 3.
Connect vertex a to b, a to c, and a to d.
Connect vertex b to e and f.
Connect vertex c (no further connection).
Connect vertex d to i, j and k.
Connect vertex e (no further connection).
Connect vertex f to g and h.
Connect vertex i to l and m.
Connect vertex j (no further connection).
Connect vertex k to n.
Connect vertex g, h, l m and n (no further connection).
a (lev 0)
b c d (lev 1)
e f i j k (lev 2)
g h l m n (lev 3)
Explanation / Answer
2) Preorder is : travserse in this order : root leftsubtree rightsubtree
post order is : traverse in this order : leftsubtree rightsubtree root
inorder is : traverse in this order : leftsubtree root rightsubtree
so following above
postorder for given tree is : e g h f b c l m i j n k d a
preorder for given tree is : a b e f g h c d i l m j k n
inorder for given tree is : e b g f h a c l i m j n k d
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.