GATE Exam  >  GATE Questions  >  The preorder traversal sequence of a binary s... Start Learning for Free
The preorder traversal sequence of a binary search tree is 30, 20, 10, 15, 25, 23, 39, 35, 42.
Which one of the following is the postorder traversal sequence of the same tree?
  • a)
    10,20,15,23,25,35,42,39,30
  • b)
    15,10,25,23,20,42,35,39,30
  • c)
    15,20,10,23,25,42,35,39,30
  • d)
    15,10,23,25,20,35,42,39,30
Correct answer is option 'D'. Can you explain this answer?
Verified Answer
The preorder traversal sequence of a binary search tree is 30, 20, 10,...
Pr eorder :30,20,10,15,25,23,39,35,42
Inorder :10,15,20,23,25,30,35,39,42
 
View all questions of this test
Most Upvoted Answer
The preorder traversal sequence of a binary search tree is 30, 20, 10,...
Explanation:

  • The first element of preorder traversal is always the root element. Therefore, the root of the tree is 30.

  • Elements less than 30 will be on the left subtree and elements greater than 30 on the right subtree.

  • The next element in preorder traversal is 20. Therefore, 20 is the left child of 30.

  • The next element in preorder traversal is 10. Therefore, 10 is the left child of 20.

  • The next element in preorder traversal is 15. Therefore, 15 is the right child of 10.

  • The next element in preorder traversal is 25. Therefore, 25 is the right child of 20.

  • The next element in preorder traversal is 23. Therefore, 23 is the left child of 25.

  • The next element in preorder traversal is 39. Therefore, 39 is the right child of 30.

  • The next element in preorder traversal is 35. Therefore, 35 is the left child of 39.

  • The next element in preorder traversal is 42. Therefore, 42 is the right child of 39.

  • Thus, the binary search tree can be represented as:




30
/ \
20 39
/ \ / \
10 25 35 42
\
23


Postorder traversal: In postorder traversal, we first traverse the left subtree, then the right subtree, and finally the root node. Therefore, the postorder traversal of the above tree is:


15
10
23
25
20
35
42
39
30


Hence, the correct answer is option D.
Explore Courses for GATE exam
The preorder traversal sequence of a binary search tree is 30, 20, 10, 15, 25, 23, 39, 35, 42.Which one of the following is the postorder traversal sequence of the same tree?a)10,20,15,23,25,35,42,39,30b)15,10,25,23,20,42,35,39,30c)15,20,10,23,25,42,35,39,30d)15,10,23,25,20,35,42,39,30Correct answer is option 'D'. Can you explain this answer?
Question Description
The preorder traversal sequence of a binary search tree is 30, 20, 10, 15, 25, 23, 39, 35, 42.Which one of the following is the postorder traversal sequence of the same tree?a)10,20,15,23,25,35,42,39,30b)15,10,25,23,20,42,35,39,30c)15,20,10,23,25,42,35,39,30d)15,10,23,25,20,35,42,39,30Correct answer is option 'D'. 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 The preorder traversal sequence of a binary search tree is 30, 20, 10, 15, 25, 23, 39, 35, 42.Which one of the following is the postorder traversal sequence of the same tree?a)10,20,15,23,25,35,42,39,30b)15,10,25,23,20,42,35,39,30c)15,20,10,23,25,42,35,39,30d)15,10,23,25,20,35,42,39,30Correct answer is option 'D'. Can you explain this answer? covers all topics & solutions for GATE 2024 Exam. Find important definitions, questions, meanings, examples, exercises and tests below for The preorder traversal sequence of a binary search tree is 30, 20, 10, 15, 25, 23, 39, 35, 42.Which one of the following is the postorder traversal sequence of the same tree?a)10,20,15,23,25,35,42,39,30b)15,10,25,23,20,42,35,39,30c)15,20,10,23,25,42,35,39,30d)15,10,23,25,20,35,42,39,30Correct answer is option 'D'. Can you explain this answer?.
Solutions for The preorder traversal sequence of a binary search tree is 30, 20, 10, 15, 25, 23, 39, 35, 42.Which one of the following is the postorder traversal sequence of the same tree?a)10,20,15,23,25,35,42,39,30b)15,10,25,23,20,42,35,39,30c)15,20,10,23,25,42,35,39,30d)15,10,23,25,20,35,42,39,30Correct answer is option 'D'. 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 The preorder traversal sequence of a binary search tree is 30, 20, 10, 15, 25, 23, 39, 35, 42.Which one of the following is the postorder traversal sequence of the same tree?a)10,20,15,23,25,35,42,39,30b)15,10,25,23,20,42,35,39,30c)15,20,10,23,25,42,35,39,30d)15,10,23,25,20,35,42,39,30Correct answer is option 'D'. Can you explain this answer? defined & explained in the simplest way possible. Besides giving the explanation of The preorder traversal sequence of a binary search tree is 30, 20, 10, 15, 25, 23, 39, 35, 42.Which one of the following is the postorder traversal sequence of the same tree?a)10,20,15,23,25,35,42,39,30b)15,10,25,23,20,42,35,39,30c)15,20,10,23,25,42,35,39,30d)15,10,23,25,20,35,42,39,30Correct answer is option 'D'. Can you explain this answer?, a detailed solution for The preorder traversal sequence of a binary search tree is 30, 20, 10, 15, 25, 23, 39, 35, 42.Which one of the following is the postorder traversal sequence of the same tree?a)10,20,15,23,25,35,42,39,30b)15,10,25,23,20,42,35,39,30c)15,20,10,23,25,42,35,39,30d)15,10,23,25,20,35,42,39,30Correct answer is option 'D'. Can you explain this answer? has been provided alongside types of The preorder traversal sequence of a binary search tree is 30, 20, 10, 15, 25, 23, 39, 35, 42.Which one of the following is the postorder traversal sequence of the same tree?a)10,20,15,23,25,35,42,39,30b)15,10,25,23,20,42,35,39,30c)15,20,10,23,25,42,35,39,30d)15,10,23,25,20,35,42,39,30Correct answer is option 'D'. Can you explain this answer? theory, EduRev gives you an ample number of questions to practice The preorder traversal sequence of a binary search tree is 30, 20, 10, 15, 25, 23, 39, 35, 42.Which one of the following is the postorder traversal sequence of the same tree?a)10,20,15,23,25,35,42,39,30b)15,10,25,23,20,42,35,39,30c)15,20,10,23,25,42,35,39,30d)15,10,23,25,20,35,42,39,30Correct answer is option 'D'. 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