// function List ---------------------------------- void List(PNODE tree,char* s,int& sp) { NODE n; PNODE p; n.value = Next(s,sp); n.lch = n.rch = NULL; if (tree == NULL) tree = &n; else{ p = tree; while(1) { if (n.value < p->value) { if (p->lch == NULL) { p->lch = &n; break; }else p = p->lch; }else{ if (p->rch == NULL) { p->rch = &n; break; }else p = p->rch; } }//endwhile } if (Next(s,sp) == -1) { // we parsed the whole string Show(tree); // display the characters putchar('\n'); }else List(tree,s,sp); }//end List