GATE Exam  >  GATE Questions  >  Which of the following traversal is sufficien... Start Learning for Free
Which of the following traversal is sufficient to construct Binary search tree from traversal?
I. Preorder
II. Inorder
III. Postorder
  • a)
    Any of the given traversal is sufficient
  • b)
    Either I or III is sufficient
  • c)
    I and III
  • d)
    II and III
Correct answer is option 'B'. Can you explain this answer?
Verified Answer
Which of the following traversal is sufficient to construct Binary sea...
To construct BST either preorder or postorder is sufficient because inorder is always sorted for BST.
View all questions of this test
Most Upvoted Answer
Which of the following traversal is sufficient to construct Binary sea...
Explanation:

To construct a binary search tree, we need at least one of the traversal techniques to be able to reconstruct the tree.

Preorder Traversal:

Preorder traversal visits the root node first, then the left subtree and finally the right subtree. It means that we can get the root node of the tree from the first element of the preorder traversal list.

Inorder Traversal:

Inorder traversal visits the left subtree first, then the root node and finally the right subtree. In a binary search tree, the left subtree contains all the nodes with values less than the root node, and the right subtree contains all the nodes with values greater than the root node. Therefore, we can use the inorder traversal list to determine the left and right subtrees of the root node recursively.

Postorder Traversal:

Postorder traversal visits the left subtree first, then the right subtree and finally the root node. It means that the last element of the postorder traversal list is the root node.

Conclusion:

Preorder and postorder traversal techniques alone are not sufficient to construct a binary search tree since they do not provide enough information about the left and right subtrees. However, using either preorder or postorder traversal in combination with inorder traversal is sufficient to construct a binary search tree. Therefore, option B is the correct answer.
Explore Courses for GATE exam
Which of the following traversal is sufficient to construct Binary search tree from traversal?I. PreorderII. InorderIII. Postordera)Any of the given traversal is sufficientb)Either I or III is sufficientc)I and IIId)II and IIICorrect answer is option 'B'. Can you explain this answer?
Question Description
Which of the following traversal is sufficient to construct Binary search tree from traversal?I. PreorderII. InorderIII. Postordera)Any of the given traversal is sufficientb)Either I or III is sufficientc)I and IIId)II and IIICorrect answer is option 'B'. Can you explain this answer? for GATE 2024 is part of GATE preparation. The Question and answers have been prepared according to the GATE exam syllabus. Information about Which of the following traversal is sufficient to construct Binary search tree from traversal?I. PreorderII. InorderIII. Postordera)Any of the given traversal is sufficientb)Either I or III is sufficientc)I and IIId)II and IIICorrect answer is option 'B'. Can you explain this answer? covers all topics & solutions for GATE 2024 Exam. Find important definitions, questions, meanings, examples, exercises and tests below for Which of the following traversal is sufficient to construct Binary search tree from traversal?I. PreorderII. InorderIII. Postordera)Any of the given traversal is sufficientb)Either I or III is sufficientc)I and IIId)II and IIICorrect answer is option 'B'. Can you explain this answer?.
Solutions for Which of the following traversal is sufficient to construct Binary search tree from traversal?I. PreorderII. InorderIII. Postordera)Any of the given traversal is sufficientb)Either I or III is sufficientc)I and IIId)II and IIICorrect answer is option 'B'. Can you explain this answer? in English & in Hindi are available as part of our courses for GATE. Download more important topics, notes, lectures and mock test series for GATE Exam by signing up for free.
Here you can find the meaning of Which of the following traversal is sufficient to construct Binary search tree from traversal?I. PreorderII. InorderIII. Postordera)Any of the given traversal is sufficientb)Either I or III is sufficientc)I and IIId)II and IIICorrect answer is option 'B'. Can you explain this answer? defined & explained in the simplest way possible. Besides giving the explanation of Which of the following traversal is sufficient to construct Binary search tree from traversal?I. PreorderII. InorderIII. Postordera)Any of the given traversal is sufficientb)Either I or III is sufficientc)I and IIId)II and IIICorrect answer is option 'B'. Can you explain this answer?, a detailed solution for Which of the following traversal is sufficient to construct Binary search tree from traversal?I. PreorderII. InorderIII. Postordera)Any of the given traversal is sufficientb)Either I or III is sufficientc)I and IIId)II and IIICorrect answer is option 'B'. Can you explain this answer? has been provided alongside types of Which of the following traversal is sufficient to construct Binary search tree from traversal?I. PreorderII. InorderIII. Postordera)Any of the given traversal is sufficientb)Either I or III is sufficientc)I and IIId)II and IIICorrect answer is option 'B'. Can you explain this answer? theory, EduRev gives you an ample number of questions to practice Which of the following traversal is sufficient to construct Binary search tree from traversal?I. PreorderII. InorderIII. Postordera)Any of the given traversal is sufficientb)Either I or III is sufficientc)I and IIId)II and IIICorrect answer is option 'B'. Can you explain this answer? tests, examples and also practice GATE tests.
Explore Courses for GATE exam
Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev