The preorder traversal sequence of a binary search tree is 25, 15, 10, 4, 12, 22, 18, 24, 50, 35, 31, 44, 70, 66, 90 Which one of the following is the postorder traversal sequence of the same tree?
The preorder traversal sequence of a binary search tree is 25, 15, 10, 4, 12, 22, 18, 24, 50, 35, 31, 44, 70, 66, 90 Which one of the following is the postorder traversal sequence of the same tree? Correct Answer 4, 12, 10, 18, 24, 22, 15, 31, 44, 35, 66, 90, 70, 50, 25
The correct answer is option 2.
Concept:
In order to build a binary tree from given traversal sequences, one of the traversal sequences must be Inorder. The other traversal sequence might be either Preorder or Postorder. We know that the Inorder traversal of a Binary Search Tree is always in ascending order.
Preorder traversal sequence of a binary search tree,
25, 15, 10, 4, 12, 22, 18, 24, 50, 35, 31, 44, 70, 66, 90
Inorder traversal sequence of a binary search tree,
4, 10, 12, 15, 18, 22, 24, 25, 31, 35, 44, 50, 66, 70, 90
Additional Information
| Tree traversal | ||||||
|
Method flow |
Inorder | preorder | postorder |
Converse Inorder |
Converse Preorder | Converse Postorder |
|
|
|
|
|
|
|