Data Structures & AlgorithmsEasyTCS NQT · Infosys pattern

A binary tree has root 1; 1's children are 2 (left) and 3 (right); 2's children are 4 (left) and 5 (right); 3 has only a right child, 6. What is its postorder traversal?

  1. A. 4 2 5 1 3 6
  2. B. 1 2 4 5 3 6
  3. C. 4 5 2 6 3 1
  4. D. 4 5 6 2 3 1

Correct answer: C. 4 5 2 6 3 1

Postorder is left, right, root: finish 2's subtree (4 5 2), then 3's subtree (6 3), then the root 1. 1 2 4 5 3 6 is preorder and 4 2 5 1 3 6 is inorder.

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic