Please enter your email address or userHandle.
Given postorder traversal of a Binary Search Tree, you need to construct a BST from postorder traversal. The output will be inorder traversal of the constructed BST.
1 7 5 50 40 10
1 5 7 10 40 50
Testcase 1: The BST for the given post order traversal is:
Thus the inorder traversal of BST is: 1 5 7 10 40 50.
The task is to complete the function constructTree() which takes an array post, size as as the argument and returns the root of BST.
Expected Time Complexity: O(Height of the BST)
Expected Auxiliary Space: O(Height of the BST)
1 <= T <= 100
1 <= N <= 100
We strongly recommend solving this problem on your own before viewing its editorial. Do you still
want to view the editorial?
Login to access your submissions.