#include typedef struct node { int data; struct node *left, *rite; } tree; int main(int argc, char* argv[]) { int n; tree *root = 0; tree *cp, **cpp; while(scanf("%d", &n) != EOF) { cpp = &root; while (cp = *cpp) cpp = &( n <= cp->data ? cp->left : cp->rite); cp = *cpp = (tree*) malloc(sizeof(tree), 1); cp->left = cp->rite = 0; cp->data = n; } inorder(root); printf("\n"); } int inorder(tree *curr) { if (curr) { inorder(curr->left); printf("%d ", curr->data); inorder(curr->rite); } }