GATE / CS ARCHIVE

GATE CSE 1996 / QUESTION 1.15

Postorder of the pictured tree

Data Structures · Tree Properties & Traversals · Full GATE CSE 1996 paper

GATE 1996, Q1.15 1 mark · MCQ
Report issue

Tree Properties & Traversals

Question 1.15, GATE 1996: For root a with left subtree b(c(g),d) and right subtree e(f), find the postorder traversal.
Question 1.15, GATE 1996: For root a with left subtree b(c(g),d) and right subtree e(f), find the postorder traversal.
Tap to enlarge
Your answer
Answer & solution

Answer: C: g,c,d,b,f,e,a (no official key was published)

Postorder visits the complete left subtree, then the complete right subtree, then the root. Within b, visit g before its parent c, then d, then b: g,c,d,b. Within e, visit f before e: f,e. Concatenate those two lists and finally append a, yielding g,c,d,b,f,e,a. The exact left-versus-right placement of a sole child does not affect postorder. Visiting a before its subtrees would be preorder, not the requested traversal.

Original paper, page 2