include[HTML_REMOVED]
using namespase std;
typedef long long ll;
typedef struct LNode *Position;
typedef Position BinTree;
const int N=2e5+100;
struct LNode
{
ll Data;
BinTree Left;
BinTree Right;
}
ll n,n,k;
Bintree BuildTree(ll Inorder[],ll Postorder[],ll n)
{
BinTree T;
if(n<=0) retrun NULL;
T=(BinTree)malloc(sizeof(struce BinTree));
T->Data=Postorder[n-1];
T->Left=NULL;
T->Right=NULL;
int i;
for(i=0;i<n;i++)
{
if(Inorder[i]==Postorder[n-1]) break;
}
T->Left=BulidTree(Inorder,PostOrder,i);
T->Right=BulidTree(Inorder+i+1,PostOrer+i,n-i-1);
return T;
}
void Preorder(BinTree T)
{
if(T)
{
BinTree queue[100];
ll left=0,right=0;
queue[right]=T;
while(left[HTML_REMOVED]Data;
else cout<<” “<[HTML_REMOVED]Data;
if(bt->Left) queue[right]=bt->Left;
if(bt->Right) queue[right++]=bt->Right;
}
}
}
int main()
{
cin>>n;
int Inorder[N];
int Postorder[N];
for(int i=0;i<n;i++) cin>>Postorder[i];
for(int i=0;i<n;i++) cin>>inorder[i];
BinTree T=BuildTree(Inorder,Postorder,n);
Preorder(T);
}
//https://blog.csdn.net/FellAveal/article/details/134597064