Data Structures & AlgorithmsModerateGATE CSE · Trees

A binary tree has inorder traversal D B E A F C and postorder traversal D E B F C A. What is its preorder traversal?

  1. A. A B D E F C
  2. B. A D B E C F
  3. C. A B E D C F
  4. D. A B D E C F

Correct answer: D. A B D E C F

A is the root; B (with children D, E) is the left subtree and C (with left child F) the right one, so preorder is A B D E C F.

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic