Implement reverse mapping from preorder to nodes.