Skip to content
Official PYQ · 1996

GATE CS 1996 Q1.15 — Trees

Explain with AI

Which of the following sequences denotes the post order traversal sequence of the below tree?

Choose one option
View worked solution

Answer: C

The binary tree represented in the image has the following structure:

  • Root: aa
    • Left child: bb
      • Left child: cc (which has a left child gg)
      • Right child: dd
    • Right child: ee (which has a left child ff)

To find the post-order traversal (Left →\rightarrow Right →\rightarrow Root):

  1. Left Subtree of aa (rooted at bb):
    • Left subtree of bb (rooted at cc): Visit left child gg, then root cc →\rightarrow g, c
    • Right child of bb: Visit dd →\rightarrow d
    • Visit root bb →\rightarrow b
    • Combined left subtree sequence: g, c, d, b
  2. Right Subtree of aa (rooted at ee):
    • Left child of ee: Visit ff →\rightarrow f
    • Visit root ee →\rightarrow e
    • Combined right subtree sequence: f, e
  3. Root node: Visit aa →\rightarrow a

Combining these steps, the complete post-order traversal sequence is: g  c  d  b  f  e  ag \; c \; d \; b \; f \; e \; a.

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Trees questions