Problem Description: (language is java)
Given an input array representing a preorder traversal of a binary search tree, output a postorder traversal of the BST.
Catch :
- No construction of BST nodes.
- No recursions.
- O(n) running time.
I have tried figuring it out for hours, but still have no clues.
The hardest part is without using the tree node struct.
Anyone have ideas?