📢 Too many exams? Don’t know which one suits you best? Book Your Free Expert 👉 call Now!


    âš¡ Month End Offer - Flat 52% Off On All Courses! Enroll Now âš¡
    00:00:00 AM Left

    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