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

Keys 97, 30, 61, 33, 46, 40, 51, 36, 31 are inserted one by one into an empty binary search tree. What is the level-order traversal?

  1. A. [97, 30, 61, 33, 31, 46, 40, 51, 36]
  2. B. [30, 31, 33, 36, 40, 46, 51, 61, 97]
  3. C. [31, 36, 40, 51, 46, 33, 61, 30, 97]
  4. D. [97, 30, 61, 33, 31, 46, 40, 36, 51]

Correct answer: A. [97, 30, 61, 33, 31, 46, 40, 51, 36]

Build the BST by inserting in order (root 97). level-order gives [97, 30, 61, 33, 31, 46, 40, 51, 36]. The other traversals of the same tree are the distractors.

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic