πŸ“’ Too many exams? Don’t know which one suits you best? Book Your Free Expert πŸ‘‰ call Now!

  • google app store apple app store
  • βœ–

      Question

      There is a BST and below is the Pre order of the BST,

      What will be it’s In order 150 70 60 80 250 200 350
      A 60 70 80 150 200 350250 Correct Answer Incorrect Answer
      B 60 70 80 200 150 250 350 Correct Answer Incorrect Answer
      C 60 200 70 80 150 250 350 Correct Answer Incorrect Answer
      D 60 70 80 150 200 250 350 Correct Answer Incorrect Answer
      E None of these Correct Answer Incorrect Answer

      Solution

      Preorder = Root β†’ Left β†’ Right First element = root β†’ 150 Remaining elements = Left (150) Left subtree of 150: 70, 60, 80 Root of left subtree = 70 Left of 70 = 60 Right of 70 = 80 Right subtree of 150: 250, 200, 350 Root of right subtree = 250 Left of 250 = 200 Right of 250 = 350 So BST structure: 150 / \ 70 250 / \ / \ 60 80 200 350 Step 3: Inorder Traversal (Left β†’ Root β†’ Right) Left subtree of 150 β†’ 60, 70, 80 Root = 150 Right subtree β†’ 200, 250, 350 Combine: 60, 70, 80, 150, 200, 250, 350 Answer (Inorder Traversal) 60 70 80 150 200 250 350

      Practice Next
      ask-question