Boxes There are N boxes, indexed by a number from 1 to N . Each box may (or not may not) be put into other boxes. These boxes together form a tree structure (or a forest structure, to be precise). You have to answer a series of queries of the followi
Given inorder and postorder traversal of a tree, construct the binary tree. Note: You may assume that duplicates do not exist in the tree. 利用中序和后序遍历构造二叉树,要注意到后序遍历的最后一个元素是二叉树的根节点,而中序遍历中,根节点前面为左子树节点后面为右子树的节点.例如二叉树:{1,2,3,4,5,6,#}的后序遍历为4->5->2->6-&