GATE / CS ARCHIVE

GATE CSE 2000 / QUESTION 2.16

Last visited vertices in binary-tree traversals

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

GATE 2000, Q2.16 2 marks · MCQ
Report issue

Tree Properties & Traversals

Question 2.16, GATE 2000: For a “complete binary tree,” compare the last vertices in postorder,inorder,preorder. Options equate inorder/postorder,inorder/preorder,preorder/postorder,or none.
Tap to enlarge
Your answer
Answer & solution

Answer: D for heap-complete trees; B for perfect/full-rightmost-path convention (no official key was published)

Step 1: Postorder ends at the root. Inorder ends at the rightmost node, while preorder ends at the last leaf visited after exploring subtrees.

Step 2: Under the modern complete-tree definition (last level filled left to right), take six heap-indexed nodes. Node 3 has left child 6 but no right child. Inorder ends at 3, preorder at 6, and postorder at 1. All three differ, so none of the proposed equalities is always true: D.

If “complete” is intended to mean perfect, the rightmost node is a leaf and is last in both inorder and preorder, giving B. The terminology ambiguity is retained rather than silently imposing the stronger shape.

Original paper, page 5