//typedef struct node *tree;
tree build(int in[], int pos[], int n)
{
tree t;
if (!n)
return NULL;
t = (tree)malloc(sizeof(struct node));
t->data = pos[n - 1];
t->left = t->right = NULL;
int i;
for (i = 0; i < n; i++)
{
if (pos[n - 1] == in[i])
break;
}
t->left = build(in, pos, i);
t->right = build(in + i + 1, pos + i, n - i - 1);
return t;
}