The first node in the tree is the only one that gets anything written to it.
void build_tree(int size, LIST_I data, TREE& t)
{
int ct;
for (ct = 0; ct < size; ++ct) {
PT_NODE p = new NODE;
p->info = data[ct];
p->left = NULL;
p->right = NULL;
if (t == NULL)
t = p;
else {
PT_NODE ptr = t,
back = NULL;
while (ptr){
back = ptr;
if (p->info < ptr->info)
ptr = ptr->right;
else
ptr = ptr->left;
}
if (back != NULL && p->info < back->info)
back->left = p;
else if (back != NULL)
back->right = p;
}
}
}