Pocket Gems Interview Question

Given a preorder traversal construct a valid binary search tree.