Data Structures & AlgorithmsHardGATE CS · ICPC regional · Product Company SDE

Keys 12, 98, 23, 44, 16, 38, 41, 70 are inserted one by one into an empty binary search tree. What is the post-order traversal?

  1. A. [12, 98, 23, 16, 44, 38, 41, 70]
  2. B. [16, 41, 38, 70, 44, 23, 98, 12]
  3. C. [12, 16, 23, 38, 41, 44, 70, 98]
  4. D. [12, 98, 23, 16, 44, 38, 70, 41]

Correct answer: B. [16, 41, 38, 70, 44, 23, 98, 12]

Build the BST by inserting in order (root 12). post-order gives [16, 41, 38, 70, 44, 23, 98, 12]. The other traversals of the same tree are the distractors.

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic