Using the pre/post order array we can recursively divide the inorder array into the left and the right subtree of the current root. The following recursive implementation allows specifying either pre or post order tree nodes and builds the tree recursively.