再满二叉树中,任意一个结点的左右子树均含有相同的节点数,同时,先序的第一个节点和后序的最后一个节点相同 。
void PreToPost(ElemType pre[],int l1,int h1,ElemType post[],int l2,int h2){
int half;
if(h1>=l1){
post[h2]=pre[l1];
half=(h1-l1)/2;
PreToPost(pre,l1+1,l1+half,post,l2,l2+half-1);
PreToPost(pre,l1+1+half,l1+half,post,l2+half,h2-1);
}
}