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

Keys 12, 33, 64, 60, 24, 16, 31 are inserted one by one into an empty binary search tree. What is the pre-order traversal?

  1. A. [12, 16, 24, 31, 33, 60, 64]
  2. B. [16, 31, 24, 60, 64, 33, 12]
  3. C. [12, 33, 24, 64, 16, 31, 60]
  4. D. [12, 33, 24, 16, 31, 64, 60]

Correct answer: D. [12, 33, 24, 16, 31, 64, 60]

Build the BST by inserting in order (root 12). pre-order gives [12, 33, 24, 16, 31, 64, 60]. The other traversals of the same tree are the distractors.

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic